public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Address,Phone")] Hotel hotel) { if (id != hotel.ID) { return(NotFound()); } if (ModelState.IsValid) { try { //_context.Update(hotel); //await _context.SaveChangesAsync(); await _context.EditHotel(hotel); } catch (DbUpdateConcurrencyException) { if (!HotelExists(hotel.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(hotel)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Name,StreetAddress,City,State,Phone")] Hotel hotel) { if (id != hotel.ID) { return(NotFound()); } if (ModelState.IsValid) { try { await _hotels.EditHotel(id, hotel); } catch (DbUpdateConcurrencyException) { if (!HotelExists(hotel.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(hotel)); }
// PUT api/Hotel/Put/5 public IHttpActionResult Put(int id, HotelViewModel hvmodel) { var h = _hotelManager.EditHotel(id, hvmodel); return(Ok(h)); }
/// <summary> /// Action To Get Hotel Details To Upadte /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult EditHotel(int id) { return(View(hotelManager.EditHotel(id))); }