コード例 #1
0
 public String UploadImgForEdit(HttpPostedFileBase fileData)
 {
     string fileNameSet = UplImg(fileData);
     int id = (int)Session["IDportfolio"];
     Session["imgList"] = null;
     if (SetPick("/Content/images/" + fileNameSet, "/Content/images/min/" + fileNameSet))
     {
         _imgList = (List<ImgUrls>) Session["imgList"];
         _imgItem = _imgList.First();
         db.PortfolioНабор.Find(id).ImgUrls.Add(_imgItem);
         db.SaveChanges();
         //return _imgItem.ID;
         return "ok";
     }
     else
     {
         return "error";
     }
 }
コード例 #2
0
 public ActionResult DellImgItem(int idPort, int idElement)
 {
     _imgItem = db.ImgUrlsНабор.Find(idElement);
     db.Entry(_imgItem).State = EntityState.Deleted;
     db.SaveChanges();
     ViewData["ID"] = db.PortfolioНабор.Find(idPort).ID;
     return PartialView("ImgEditPartial", db.PortfolioНабор.Find(idPort).ImgUrls.ToList());
 }