public IActionResult Edit(HotelViewModel entity) { if (ModelState.IsValid) { var hotel = _mapper.Map <Hotel>(entity); _hotelService.Edit(hotel); return(RedirectToAction(nameof(GetDetailsByKey), new { hotelId = entity.Id })); } return(View(entity)); }
public async Task <ActionResult> Edit(long id, Hotel hotel) { try { await hotelService.Edit(id, hotel); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public IActionResult Update([FromForm] HotelViewModel entity) { if (ModelState.IsValid) { var hotel = _mapper.Map <Hotel>(entity); _hotelService.Edit(hotel); return(Ok()); } return(StatusCode(304)); }