//Uodates the house owner public IActionResult OnPost() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(HouseOwner).State = EntityState.Modified; try { _context.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!HouseOwnerExists(HouseOwner.Id)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
//Creates a house . public IActionResult OnPost() { if (!ModelState.IsValid) { return(Page()); } _context.House.Add(House); _context.SaveChanges(); return(RedirectToPage("./Index")); }
//Removes the house uses linq to get house record. public IActionResult OnPost(int?id) { if (id == null) { return(NotFound()); } House = (from house in _context.House where house.Id == id select house).FirstOrDefault(); if (House != null) { _context.House.Remove(House); _context.SaveChanges(); } return(RedirectToPage("./Index")); }
//Removes tenant. selects tenant using a linq query. public IActionResult OnPost(int?id) { if (id == null) { return(NotFound()); } Tenant = (from tenant in _context.Tenant where tenant.Id == id select tenant).FirstOrDefault(); if (Tenant != null) { _context.Tenant.Remove(Tenant); _context.SaveChanges(); } return(RedirectToPage("./Index")); }
//Deletes the contract uses linq query to select the contract. public IActionResult OnPost(int?id) { if (id == null) { return(NotFound()); } Contract = (from contract in _context.Contract where contract.Id == id select contract).FirstOrDefault(); if (Contract != null) { _context.Contract.Remove(Contract); _context.SaveChanges(); } return(RedirectToPage("./Index")); }