public ActionResult EditRole(aspnet_Role role) { var rolesGridModel = new RolesJqGridModel(GetRolesColumns()); if (rolesGridModel.Grid.AjaxCallBackMode == AjaxCallBackMode.AddRow) { RoleService.Create(role.RoleName, role.Description); } if (rolesGridModel.Grid.AjaxCallBackMode == AjaxCallBackMode.EditRow) { using (var contex = db) { aspnet_Role roleold = contex.aspnet_Roles.FirstOrDefault(r => r.RoleId == role.RoleId); //roleold.RoleName = role.RoleName; roleold.Description = role.Description; //roleold.LoweredRoleName = role.RoleName.ToLower(); contex.SaveChanges(); } } if (rolesGridModel.Grid.AjaxCallBackMode == AjaxCallBackMode.DeleteRow) { RoleService.Delete(role.RoleId); } return(RedirectToAction("Roles", "Account")); }
public ActionResult RolesExportToExcel() { var rolesGridModel = new RolesJqGridModel(GetRolesColumns()); var contex = db; var roles = contex.aspnet_Roles.Select(s => new { s.RoleName, s.Description }); DataTable dt = Helpers.LinqToDataTable(roles); rolesGridModel.Grid.ExportToExcel(dt); return(View()); }
public JsonResult RolesGridData() { var contex = db; var rolesGridModel = new RolesJqGridModel(GetRolesColumns()); SetupRolesGrid(rolesGridModel.Grid); //var rolesGrid = rolesGridModel.Grid; var roles = contex.aspnet_Roles; return(rolesGridModel.Grid.DataBind(roles)); }
public ActionResult Roles() { var rolesGridModel = new RolesJqGridModel(GetRolesColumns()); var rolesGrid = rolesGridModel.Grid; SetupRolesGrid(rolesGrid); //var contex = db; //string sql = "select * from aspnet_roles"; //var roles = contex.aspnet_Roles; return(View(rolesGridModel)); }