Guest User

Untitled

a guest
Aug 20th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. public async Task<IActionResult> Delete(int? id)
  2. {
  3. if (id == null)
  4. {
  5. return NotFound();
  6. }
  7.  
  8. var country = await _context.Countries
  9. .SingleOrDefaultAsync(m => m.Id == id);
  10. if (country == null)
  11. {
  12. return NotFound();
  13. }
  14.  
  15. return PartialView(country);
  16. }
  17.  
  18. public class Country
  19. {
  20. public int Id { get; set; }
  21. [Required]
  22. public string Name { get; set; }
  23.  
  24.  
  25. }
  26.  
  27. public class City
  28. {
  29. public int Id { get; set; }
  30.  
  31. [Required]
  32. public string Name { get; set; }
  33.  
  34. public Country Country { get; set; }
  35.  
  36.  
  37. }
Add Comment
Please, Sign In to add comment