public JsonResult getList()
 {
     var db=new agadContext();
     var id=Convert.ToInt32(Request["cityID"]);
     var list = db.TOWNs.Where(w => w.CITY_ID == id).ToList();
     return Json(list, JsonRequestBehavior.DenyGet);
 }
 public ActionResult changeState(string confirmComment, int confirmState, int detailID)
 {
     var db = new agadContext();
     var item = db.AGADs.Where(w => w.Id == detailID).FirstOrDefault();
     var confirmSt = db.CONFIRMSTATEs.Where(w => w.Id == confirmState).FirstOrDefault();
     if (item == null || confirmSt == null)
     {
         throw new HttpException(404, "Hatalı Öge");
     }
     item.CONFIRMSTATEID = confirmState;
     item.CONFIRMCOMMENT = confirmComment;
     db.SaveChanges();
     return Redirect("/admin/detay/" + detailID);
 }
        //
        // GET: /AGAD/
        public ActionResult Index()
        {
            using(var db=new agadContext())
            {

                ViewBag.lastAgadList = (from item in db.AGADs

                                        where (item.CONFIRMSTATE_Item.Id != (int)CONFIRMSTATEENUM.NOTACCEPTED)
                                        select item).ToList<Models.AGAD>();
                ViewBag.agadType = (from type in db.AGADTYPEs select type).ToList();
                ViewBag.agadCityList = (from city in db.CITies select city).ToList();
                ViewBag.agadTownList = (from town in db.TOWNs where (town.CITY_ID == 1) select town).ToList();

                Session["imagePaths"] = null;
                return View(ViewBag);
            }
        }