public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Price,Description,TypeOf,Value")] BronHotel bronHotel) { if (id != bronHotel.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(bronHotel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BronHotelExists(bronHotel.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(bronHotel)); }
public async Task <IActionResult> Create([Bind("Id,Name,Price,Description,TypeOf,Value")] BronHotel bronHotel) { if (ModelState.IsValid) { _context.Add(bronHotel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(bronHotel)); }