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));
        }
Exemple #2
0
        public async Task <ActionResult> Edit(long id, Hotel hotel)
        {
            try
            {
                await hotelService.Edit(id, hotel);

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }
Exemple #3
0
        public IActionResult Update([FromForm] HotelViewModel entity)
        {
            if (ModelState.IsValid)
            {
                var hotel = _mapper.Map <Hotel>(entity);

                _hotelService.Edit(hotel);

                return(Ok());
            }

            return(StatusCode(304));
        }