public ActionResult SaveRole(sec_UserRoleRepo repo_role) { try { repo_role.MakerId = GlobalValue.User_ID; repo_role.MakeDate = GlobalValue.Scheme_Today_Date; repo_role.UserRoleStatus = "ACTIVE"; if (this.ModelState.IsValid) { if (string.IsNullOrEmpty(repo_role.UserRoleId)) { //validate rolename if (repo_role.Validate_UseId_GroupName_RoleName("name", "role", "add", repo_role.UserRoleName, "x") > 0) { X.Msg.Show(new MessageBoxConfig { Title = "Error", Message = repo_role.UserRoleName + " already exist. Operation Aborted", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.ERROR, Width = 350 }); return(this.Direct()); } } if ((repo_role.UserRoleId == "R10") || (repo_role.UserRoleId == "R100")) { X.Msg.Show(new MessageBoxConfig { Title = "Error", Message = "Cannot edit system role.", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.ERROR, Width = 350 }); return(this.Direct()); } if (this.repo_role.Add_Update_UserRole(repo_role)) { X.Msg.Show(new MessageBoxConfig { Title = "Success", Message = "Saved successfully.", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.INFO, Width = 350 }); Store store = X.GetCmp <Store>("rolestore"); store.Reload(); ClearControls(); } return(this.Direct()); } else { var errors = ModelState.Values.SelectMany(v => v.Errors); X.Msg.Show(new MessageBoxConfig { Title = "Error", Message = " Insufficient data. Operation Aborted", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.ERROR, Width = 350 }); return(this.Direct()); } //return this.Direct(); } catch (Exception ex) { string sss = ex.ToString(); return(this.Direct()); //throw; } }