Ejemplo n.º 1
0
 public IActionResult CreateBranch(LibraryBranch newBranch, IFormFile ImageUrl)
 {
     newBranch.ImageUrl = "/images/branch/" + ImageUrl.FileName;
     _branch.Add(newBranch);
     if (ImageUrl != null)
     {
         var fileName = Path.Combine(he.WebRootPath + "/images/branch", Path.GetFileName(ImageUrl.FileName));
         ImageUrl.CopyTo(new FileStream(fileName, FileMode.Create));
     }
     return(RedirectToAction("ListBranch"));
 }