public async Task <ActionResult> UpdateBookingRequest([FromRoute] Guid id, [FromBody] UpdateBookingRequestDto request) { try { await _service.Update(id, request); } catch (KeyNotFoundException) { return(NotFound()); } return(NoContent()); }
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(); }