public ActionResult CheckEdit(Models.StudyApply.CheckEdit vm) { using (var db = new XkSystem.Models.DbContext()) { var error = new List <string>(); if (error.Count == decimal.Zero) { if (vm.CheckStudyApplyEdit.Id != 0) { var tb = (from p in db.Table <Study.Entity.tbStudyApply>() where p.Id == vm.CheckStudyApplyEdit.Id select p).FirstOrDefault(); if (tb != null) { tb.tbCheckUser = db.Set <Sys.Entity.tbSysUser>().Find(Code.Common.UserId); tb.CheckStatus = vm.CheckStudyApplyEdit.CheckStatus; tb.CheckDate = DateTime.Now; tb.CheckRemark = vm.CheckStudyApplyEdit.CheckRemark; if (db.SaveChanges() > 0) { XkSystem.Areas.Sys.Controllers.SysUserLogController.Insert("修改晚自习审核"); } } else { error.AddError(Resources.LocalizedText.MsgNotFound); } } } return(Code.MvcHelper.Post(error, Url.Action("CheckList"))); } }
public ActionResult CheckEdit(int id = 0) { using (var db = new XkSystem.Models.DbContext()) { var vm = new Models.StudyApply.CheckEdit(); if (id != 0) { vm.CheckStatusList = typeof(Code.EnumHelper.CheckStatus).ToItemList(); var tb = (from p in db.Table <Study.Entity.tbStudyApply>() where p.Id == id select new Dto.StudyApply.CheckEdit { Id = p.Id, Remark = p.Remark, CheckStatus = p.CheckStatus, CheckRemark = p.CheckRemark }).FirstOrDefault(); if (tb != null) { vm.CheckStudyApplyEdit = tb; } } return(View(vm)); } }