Пример #1
0
        private async Task ValidatePostBookAsync(BookMobilePostDto bookDto, Book book)
        {
            var bookExistsInChosenOffice = book
                                           .BookOffices
                                           .Any((l => l.OfficeId == bookDto.OfficeId));

            _serviceValidator.ThrowIfBookExist(bookExistsInChosenOffice);

            var officeExists = await _officeDbSet.AnyAsync(o => o.Id == bookDto.OfficeId);

            _serviceValidator.ThrowIfOfficeDoesNotExist(officeExists);
        }