public JsonResult saveAgad(AGAD.Models.AGAD model)
        {
            if (ModelState.IsValid)
            {
                using(var db=new AGAD.Models.agadContext())
                {
                    using (var trans = db.Database.BeginTransaction())
                    {
                        try
                        {
                            if (Session["imagePaths"] != null)
                            {

                                db.AGADs.Add(model);

                               var liste=Session["imagePaths"] as List<string>;
                                foreach(var item in liste)
                                {
                                    db.IMAGEPATHs.Add(new IMAGEPATH
                                    {
                                        AGAD_ID=model.Id,
                                        PATH=item
                                    });

                                }

                            }
                            db.SaveChanges();
                            trans.Commit();
                        }
                        catch (Exception ex)
                        {
                            trans.Rollback();
                            return Json(new { success = false });
                        }
                    }
                }
                return Json(new { success = true });
            }
            else
            {
                return Json(new { success = false });
            }
        }
 public ActionResult getDetailAGAD(int detailPage)
 {
     ViewBag.homeIcon = true;
     var db = new AGAD.Models.agadContext();
     var user = db.USERs.Where(w => w.EMAIL == User.Identity.Name).FirstOrDefault();
     if (user != null)
     {
         ViewBag.userName = user.NAME + " " + user.SURNAME;
     }
     ViewBag.confirmState = db.CONFIRMSTATEs.ToList();
     ViewBag.ID = detailPage;
     var model = db.AGADs.Where(w => w.Id == detailPage).FirstOrDefault();
     if (model == null)
     {
         throw new HttpException(404, "Hatalı Öge");
     }
     if(model.CONFIRMSTATEID==(int)CONFIRMSTATEENUM.NOTACCEPTED)
     {
         model.CONFIRMSTATEID = (int)CONFIRMSTATEENUM.PROCESSING;
         db.SaveChanges();
     }
     model.USER_TC = user.TC;
     return View("~/Views/ADMIN/_detailAGAD.cshtml", model);
 }