コード例 #1
0
 public ActionResult AddPhoto(IEnumerable <HttpPostedFileBase> uploads, int id)
 {
     foreach (var file in uploads)
     {
         if (file != null)
         {
             string fileName = System.IO.Path.GetFileName(file.FileName);
             photoservice.AddToAlbum(id,
                                     $"/Content/Images/UsersImages/profile{albumservice.GetAlbumEntity(id).UserId}_{id}" + fileName);
             file.SaveAs(
                 Server.MapPath(
                     $"~/Content/Images/UsersImages/profile{albumservice.GetAlbumEntity(id).UserId}_{id}" +
                     fileName));
         }
     }
     return(RedirectToAction("AlbumView", "UserAccount", new { id }));
 }