예제 #1
0
파일: BookManager.cs 프로젝트: ArgusDev/3p
        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();
        }
예제 #2
0
 public void ExtendExpectedReturnDate([FromBody] ExtendExpectedReturnDateCriteriaDto extendExpectedReturnDateCriteriaDto)
 {
     _bookManager.ExtendExpectedReturnDate(extendExpectedReturnDateCriteriaDto);
 }