Exemple #1
0
 public ActionResult Edit(MiseryIndex MiseryIndex)
 {
     if (ModelState.IsValid)
     {
         DB.Entry(MiseryIndex).State = EntityState.Modified;
         DB.SaveChanges();
         TempData["msg"] = "تمت عملية التعديل بنجاح";
         return(RedirectToAction("Index"));
     }
     return(PartialView(MiseryIndex));
 }
Exemple #2
0
 public ActionResult Create(MiseryIndex MiseryIndex)
 {
     if (ModelState.IsValid)
     {
         DB.MiseryIndexes.Add(MiseryIndex);
         DB.SaveChanges();
         TempData["msg"] = "تمت عملية الاضافة بنجاح";
         return(RedirectToAction("Index"));
     }
     return(PartialView(MiseryIndex));
 }
Exemple #3
0
        public ActionResult Details(int id)
        {
            MiseryIndex ws = DB.MiseryIndexes.FirstOrDefault(x => x.MiseryId == id);

            if (ws != null)
            {
                return(PartialView(ws));
            }
            TempData["msg"] = "خطأ ";
            return(RedirectToAction("Index"));
        }
Exemple #4
0
        public ActionResult Edit(int id)
        {
            MiseryIndex ws = DB.MiseryIndexes.FirstOrDefault(x => x.MiseryId == id);

            if (ws != null)
            {
                ViewBag.AllMarket = new SelectList(DB.Markets.Select(e => new { e.MarketId, e.MarketArName }), "MarketId", "MarketArName");
                ViewBag.AllYears  = new SelectList(DB.Years.Select(e => new { e.YearId, e.YearN }), "YearId", "YearN");

                return(PartialView(ws));
            }
            TempData["msg"] = "خطأ ";
            return(RedirectToAction("Index"));
        }
Exemple #5
0
        public ActionResult Delete(int id)
        {
            MiseryIndex ws = DB.MiseryIndexes.FirstOrDefault(x => x.MiseryId == id);


            if (ws != null)
            {
                DB.MiseryIndexes.Remove(ws);
                DB.SaveChanges();
                TempData["msg"] = "تمت عملية الحذف بنجاح";
                return(RedirectToAction("Index"));
            }
            TempData["msg"] = "خطأ ";
            return(RedirectToAction("Index"));
        }