public virtual void ExtendExpectedReturnDate(ExtendExpectedReturnDateCriteriaDto extendExpectedReturnDateDto) { if (extendExpectedReturnDateDto == null) { throw new ArgumentNullException(); } BookAssignment bookAssignment = _entityDbContext.BookAssignments.SingleOrDefault(ba => ba.Id == extendExpectedReturnDateDto.BookAssignementId); if (bookAssignment == null) { throw new DataException($"BookAssignments with id '{extendExpectedReturnDateDto.BookAssignementId}' does not exist"); } if (bookAssignment.ReturnedDate != null) { throw new DataException("This book is already returned."); } bookAssignment.ExpectedReturnedDate = extendExpectedReturnDateDto.ExpectedReturnDate; _entityDbContext.SaveChanges(); }
public void ExtendExpectedReturnDate([FromBody] ExtendExpectedReturnDateCriteriaDto extendExpectedReturnDateCriteriaDto) { _bookManager.ExtendExpectedReturnDate(extendExpectedReturnDateCriteriaDto); }