コード例 #1
0
        public ActionResult Details(int id)
        {
            WiseSaying ws = DB.WiseSayings.Find(id);

            if (ws != null)
            {
                return(PartialView(ws));
            }
            TempData["msg"] = "خطأ فى كود المقولة";
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public ActionResult Edit(WiseSaying wiseSaying)
 {
     if (ModelState.IsValid)
     {
         DB.Entry(wiseSaying).State = EntityState.Modified;
         DB.SaveChanges();
         TempData["msg"] = "تمت عملية التعديل بنجاح";
         return(RedirectToAction("Index"));
     }
     return(PartialView(wiseSaying));
 }
コード例 #3
0
 public ActionResult Create(WiseSaying wiseSaying)
 {
     if (ModelState.IsValid)
     {
         wiseSaying.WiseSayingDate = DateTime.Now;
         DB.WiseSayings.Add(wiseSaying);
         DB.SaveChanges();
         TempData["msg"] = "تمت عملية الاضافة بنجاح";
         return(RedirectToAction("Index"));
     }
     return(PartialView(wiseSaying));
 }
コード例 #4
0
        public ActionResult Edit(int id)
        {
            WiseSaying ws = DB.WiseSayings.Find(id);

            if (ws != null)
            {
                ViewBag.AllElders = new SelectList(DB.Elders.Select(e => new { e.EldersID, e.EldersName }), "EldersID", "EldersName");
                ViewBag.AllStatus = new SelectList(DB.Status.Select(s => new { s.StatusID, s.StatusName }), "StatusID", "StatusName");
                return(PartialView(ws));
            }
            TempData["msg"] = "خطأ فى كود المقولة";
            return(RedirectToAction("Index"));
        }
コード例 #5
0
        public ActionResult Delete(int id)
        {
            WiseSaying ws = DB.WiseSayings.Find(id);

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