public JsonResult EmployeeDemandConfigEditSave(T_EmployDemandConfig model) { T_EmployDemandConfig editModel = db.T_EmployDemandConfig.Find(model.ID); if (editModel != null) { editModel.Name = model.Name; editModel.Step = model.Step; editModel.isMultiple = model.isMultiple; editModel.Type = model.Type; db.Entry <T_EmployDemandConfig>(editModel).State = System.Data.Entity.EntityState.Modified; try { db.SaveChanges(); return(Json(new { State = "Success" }, JsonRequestBehavior.AllowGet)); } catch (DbEntityValidationException e) { return(Json(new { State = "Faile", Message = e.EntityValidationErrors.First().ValidationErrors.First().ErrorMessage }, JsonRequestBehavior.AllowGet)); } } else { return(Json(new { State = "Faile", Message = "保存失败请重试" }, JsonRequestBehavior.AllowGet)); } }
public JsonResult EmployeeDemandConfigAddSave(T_EmployDemandConfig model) { try { //model.Step = -1; db.T_EmployDemandConfig.Add(model); db.SaveChanges(); return(Json(new { State = "Success" }, JsonRequestBehavior.AllowGet)); } catch (DbEntityValidationException e) { return(Json(new { State = "Faile", Message = e.EntityValidationErrors.First().ValidationErrors.First().ErrorMessage }, JsonRequestBehavior.AllowGet)); } }
public JsonResult EmployeeDemandConfigDelete(int ID) { T_EmployDemandConfig delModel = db.T_EmployDemandConfig.Find(ID); if (delModel == null) { return(Json(-1)); } else { db.T_EmployDemandConfig.Remove(delModel); int i = db.SaveChanges(); return(Json(i)); } }
public ActionResult ViewEmployeeDemandConfigEdit(int ID) { T_EmployDemandConfig model = db.T_EmployDemandConfig.Find(ID); ViewData["boolList"] = Com.BoolList; ViewData["TypeList"] = TypeList(); if (model == null) { return(HttpNotFound()); } else { return(View(model)); } }