public ActionResult AddRole(RoleAddModel model) { if (model.FunctionIDs.Count == 0) { ModelState.AddModelError("FunctionIDs", Asiatek.Resource.DataAnnotations.RoleMustHaveOneFunction); } if (ModelState.IsValid) { var result = RoleBLL.AddRoleInfo(model, base.UserIDForLog); base.DoLog(Model.OperationTypeEnum.Add, result, "RoleName:" + model.RoleName); return(Json(result)); } else { if (IsSuperAdmin) { model.FunctionTreeNodes = FunctionBLL.GetAllFunctionsForTree(); } else { model.FunctionTreeNodes = FunctionBLL.GetNormalFunctionsForTree(); } model.FunctionTreeNodes.ForEach(node => { if (model.FunctionIDs.Contains(node.ID)) { node.Checked = true; } }); return(PartialView("_AddRole", model)); } }
public MessageResult AddRoleInfo(RoleInfoModel roleInfo) { try { var result = roleBLL.AddRoleInfo(roleInfo); return(MessageResult.Success(result)); } catch (Exception ex) { return(MessageResult.Fail(ex.Message)); } }