public ActionResult Details(int id) { WiseSaying ws = DB.WiseSayings.Find(id); if (ws != null) { return(PartialView(ws)); } TempData["msg"] = "خطأ فى كود المقولة"; return(RedirectToAction("Index")); }
public ActionResult Edit(WiseSaying wiseSaying) { if (ModelState.IsValid) { DB.Entry(wiseSaying).State = EntityState.Modified; DB.SaveChanges(); TempData["msg"] = "تمت عملية التعديل بنجاح"; return(RedirectToAction("Index")); } return(PartialView(wiseSaying)); }
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)); }
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")); }
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")); }