public async Task <IActionResult> Edit(HotelMVC hotel) { if (ModelState.IsValid) { _db.Update(hotel); await _db.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(hotel)); }
public async Task <IActionResult> Create(HotelMVC hotel) { if (ModelState.IsValid) { //if valid _db.HotelMvcs.Add(hotel); await _db.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(hotel)); }