Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. public Task<Postcode> GetOne(string id) =>
  2.  
  3. _context.Postcode.Include(p => p.DataZoneNavigation).AsNoTracking().FirstOrDefaultAsync(m => m.Postcode1 == id);
  4.  
  5. public class Postcode
  6. {
  7. public string Postcode1 { get; set; }
  8. public string DataZone { get; set; }
  9.  
  10. public virtual Data DataZoneNavigation { get; set; }
  11. }
  12.  
  13. Task<Postcode> GetOne(string id);
  14.  
  15. // GET: Postcodes/Details/5
  16. public async Task<IActionResult> Details(string id)
  17. {
  18. if (id == null)
  19. {
  20. return NotFound();
  21. }
  22.  
  23. var postcode = await _postcodesRepository.GetOne(id);
  24.  
  25. if (postcode == null)
  26. {
  27. return NotFound();
  28. }
  29.  
  30. return View(postcode);
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement