예제 #1
0
 public ActionResult Upload(HttpPostedFileBase uploaded,string AlbumName, string Title, string spetification)
 {
     var user = AuthHelper.GetUser(HttpContext);
     if (uploaded != null)
     {
         Photo image = new Photo()
         {
             IDPhoto = Guid.NewGuid(),
             Name = Title,
             Spetification = spetification,
             CountLikes = 0,//не пишет в дб
             Image = new byte[uploaded.ContentLength],
             ImageType = uploaded.ContentType
         };
         if (AlbumName != null)
         {
             image.IDAlbum = Binder.GetIdAlbum(user.idUser, AlbumName);//берет имменно такой альбом
         }
         else
         {
             image.IDAlbum = Binder.GetIdAlbum(user.idUser, "Other");
         }
         using (BinaryReader br = new BinaryReader(uploaded.InputStream))
         {
             image.Image = br.ReadBytes(image.Image.Length);
         }
         Binder.Add(image);
         //return File(image.Image, uploaded.ContentType);
     }
     return RedirectToAction("Profile", "User", user);
 }
예제 #2
0
파일: Binder.cs 프로젝트: sstuteam/fuffy
 public static bool Add(Photo image)
 {
     return bll.AddPhoto(image);
 }