public ActionResult TurnEdit(Model_TurnEdit model) { Tbl_Turn _Turn = db.Tbl_Turn.Where(a => a.Turn_ID == model.ID).SingleOrDefault(); if (_Turn != null) { _Turn.Turn_Name = model.Titel; _Turn.Turn_IsActive = model.Activeness; _Turn.Turn_Description = model.Descripton; db.Entry(_Turn).State = EntityState.Modified; if (Convert.ToBoolean(db.SaveChanges() > 0)) { TempData["TosterState"] = "success"; TempData["TosterType"] = TosterType.Maseage; TempData["TosterMassage"] = "عملیات با موفقیت انجام شده"; return(RedirectToAction("Index")); } else { TempData["TosterState"] = "error"; TempData["TosterType"] = TosterType.Maseage; TempData["TosterMassage"] = "خطا"; return(RedirectToAction("Index")); } } return(View()); }
public ActionResult TurnEdit(int id) { Model_TurnEdit model = db.Tbl_Turn.Where(a => a.Turn_ID == id).Select(a => new Model_TurnEdit { ID = a.Turn_ID, Activeness = a.Turn_IsActive, Descripton = a.Turn_Description, Titel = a.Turn_Name, }).SingleOrDefault(); return(PartialView(model)); }