public async Task <IActionResult> OnGetAsync(long?id) { if (id == null) { return(NotFound()); } Oteli = await _context.Oteli.FirstOrDefaultAsync(m => m.ID == id); if (Oteli == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnPostAsync(long?id) { if (id == null) { return(NotFound()); } Oteli = await _context.Oteli.FindAsync(id); if (Oteli != null) { _context.Oteli.Remove(Oteli); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public void Init() { if (Strani != null) { foreach (var s in Strani) { s.Kurorti = Kurorti.Where((k) => k.StranaId == s.Id).ToList(); } } if (Oteli != null) { foreach (var o in Oteli) { o.Turi = Turi.Where((t) => t.OtelId == o.Id).ToList(); } } if (Kurorti != null) { foreach (var k in Kurorti) { k.Oteli = Oteli.Where((o) => o.KurortId == k.Id).ToList(); } } }