public ActionResult DoAddRoleInfo(RoleInfo model) { //创建一个新的Action方法,需要对未提交的属性进行初始化赋值 //数据验证 if (roleInfoBLL.AddValidation(model.RoleName)) { return Content("validation fails"); } model.DelFlag = false; model.SubTime = DateTime.Now; model.ModifiedOnTime = DateTime.Now; try { roleInfoBLL.Create(model); return Content("ok"); } catch { return Content("error"); } }
public ActionResult DoEditRoleInfo(RoleInfo model) { if (roleInfoBLL.EditValidation(model.ID, model.RoleName)) { return Content("validation fails"); } model.ModifiedOnTime = DateTime.Now; if (roleInfoBLL.Update(model)) { return Content("ok"); } else { return Content("error"); } }