public HttpResponseMessage GetPermissions(PermissionsViewModel model) { try { List <PERMISSION> rights = new List <PERMISSION>(); int limit = int.Parse(model.limit); int start = 0; if (model.page == "1") { start = 0; } else { start = ((int.Parse(model.page) * int.Parse(model.page)) - 5) + 1; }; rights = ApplicationRoleManager.GetPermissions(start, limit); int count = ApplicationRoleManager.GetPermissionsCount(); model.ListDiritti = rights; model.Totale = count.ToString(); } catch (Exception ex) { model.success = "false"; model.message = ex.Message; } return(this.Request.CreateResponse <PermissionsViewModel>(HttpStatusCode.OK, model)); }