コード例 #1
0
        public async Task <ActionResult> UpdateBookingRequest([FromRoute] Guid id, [FromBody] UpdateBookingRequestDto request)
        {
            try
            {
                await _service.Update(id, request);
            }
            catch (KeyNotFoundException) {
                return(NotFound());
            }

            return(NoContent());
        }
コード例 #2
0
        public async Task Update(Guid id, UpdateBookingRequestDto request)
        {
            var bookingRequest = await GetById(id);

            bookingRequest.ItemId    = request.ItemId;
            bookingRequest.StartDate = request.StartDate;
            bookingRequest.EndDate   = request.EndDate;
            bookingRequest.Comment   = request.Comment;

            _repository.Update(bookingRequest);
            await _context.SaveChangesAsync();
        }