public async Task <InputUpdateBooking> Put(BookingDtoPut booking)
        {
            var model  = _mapper.Map <BookingModel>(booking);
            var entity = _mapper.Map <Booking>(model);
            var result = await _repository.UpdateAsync(entity);


            return(_mapper.Map <InputUpdateBooking>(result));
        }
Esempio n. 2
0
        public async Task <ActionResult> Put([FromBody] BookingDtoPut booking)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            try
            {
                var result = await _service.Put(booking);

                if (result != null)
                {
                    return(Ok(result));
                }
                else
                {
                    return(BadRequest());
                }
            }
            catch (ArgumentException e)
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError, e.Message));
            }
        }