예제 #1
0
        public ActionResult Arcive(int id, HttpPostedFileBase uploadFile)
        {
            var fileName = $"BookId_{id}_{uploadFile.FileName}";
            var archive  = new ArchiveViewModel
            {
                Id       = id,
                FilePath = fileName,
                BookId   = id
            };

            var archiveMap = _mapper.Map <ArchiveModel>(archive);

            _fileStorage.CreateArchive(fileName, uploadFile.InputStream);
            _bookService.AddArchive(id, archiveMap);

            return(RedirectToAction("Index"));
        }