public async Task <IActionResult> AddDocumentCase(DocViewModel model) { if (ModelState.IsValid) { if (model.UploadedFile != null) { // путь к папке Files string path = @"\Files\Cases\" + model.UploadedFile.FileName; // сохраняем файл в папку Files в каталоге wwwroot using (var fileStream = new FileStream(_webHostEnvironment.WebRootPath + path, FileMode.Create)) { await model.UploadedFile.CopyToAsync(fileStream); } _caseService.AddDocument(new CaseDocDTO { Name = model.UploadedFile.FileName, Path = path, Date = DateTime.Now.Date, CaseId = model.SomethingId }); return(RedirectToAction("AboutCase", "Case", new { id = model.SomethingId })); } } return(PartialView(model)); }