public ActionResult Modify(GlareSysEfDbAndModels.ProjectInfo subject) { ResultHelper objResult = null; try { using (LedDb db = new LedDb()) { if (ModelState.IsValid) { ProjectInfo aSubject = db.ProjectInfo.Where(p => p.Id == subject.Id).FirstOrDefault(); aSubject.ProjectName = subject.ProjectName; aSubject.ManagerName = subject.ManagerName; aSubject.Address = subject.Address; aSubject.ManagerTel = subject.ManagerTel; aSubject.OrgId = subject.OrgId; aSubject.GroupId = subject.GroupId; aSubject.UpdateDt = DateTime.Now; string strMsg = string.Empty; bool b = ProjectBll.UpdateProejct(ref subject, out strMsg); if (b) { objResult = new ResultHelper() { Status = true, Ret = 0, Obj = subject, Msg = strMsg, Desc = strMsg }; } else { objResult = new ResultHelper() { Desc = strMsg, Msg = strMsg, Obj = null, Ret = -1, Status = false }; } //if (db.SaveChanges() > 0) //{ // objResult = new ResultHelper() // { // Status = true, // Ret = 0, // Obj = subject, // Msg = "Edit Success!", // Desc = "Edit Success!" // }; //} //else //{ // objResult = new ResultHelper() // { // Desc = "Edit Faile,please try again.", // Msg = "Edit Faile,please try again.", // Obj = null, // Ret = -1, // Status = false // }; //} } else { objResult = new ResultHelper() { Desc = " Faile,please try again", Msg = " Faile,please try again", Obj = null, Ret = -1, Status = false }; } } } catch (Exception ex) { objResult = new ResultHelper() { Desc = ex.Message, Msg = ex.Message, Obj = null, Ret = -1, Status = false }; } return(Json(objResult)); }