예제 #1
0
        public void AddArchive(int id, ArchiveModel entity)
        {
            if (id == null)
            {
                throw new ArgumentNullException(nameof(id));
            }

            var book = _bookRepository.GetById(id);

            if (book is null)
            {
                throw new Exception("Book not found");
            }

            book.ArchivePath = entity.FilePath;

            _bookRepository.Update(book);

            var archiveMap = _mapper.Map <Archive>(entity);

            _archiveRepository.Create(archiveMap);
        }
예제 #2
0
 public void Create(HttpPostedFileBase file, Archive archive)
 {
     _archiveRepository.Create(file, archive);
 }