public ActionResult AppPostAddSuggestion(Suggestion entity) { JsonMessage retJson = new JsonMessage(); using (LoveBankDBContext db = new LoveBankDBContext()) { if (entity.AddUser>0) { var addUserModel = (from v in db.T_Vol where v.ID == entity.AddUser select new { v.DepId, v.Phone, v.RealName }).FirstOrDefault(); entity.DepId = addUserModel.DepId; entity.AddUserName = addUserModel.RealName; entity.AddUserPhone = addUserModel.Phone; } entity.AddTime = DateTime.Now; db.Add<Suggestion>(entity); db.SaveChanges(); retJson.Status = true; retJson.Info = "新增成功"; } return Json(retJson); }
public ActionResult PostAddSuggestion(Suggestion entity) { JsonMessage retJson = new JsonMessage(); using (LoveBankDBContext db = new LoveBankDBContext()) { entity.DepId = BaseWebSiteConifg.DeptId; if (User != null) { entity.AddUserName = User.RealName; entity.AddUserPhone = User.Phone; entity.AddUser = User.ID; } entity.AddTime = DateTime.Now; db.Add<Suggestion>(entity); db.SaveChanges(); retJson.Status = true; retJson.Info = "提交成功"; } return Json(retJson); }