public HttpResponseMessage GetRoles(ApplicationRolesViewModel model) { try { List <ApplicationRole> roles = new List <ApplicationRole>(); 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; }; roles = ApplicationRoleManager.GetRoles(start, limit); int count = ApplicationRoleManager.GetRolesCount(); model.ListRuoli = roles; model.Totale = count.ToString(); } catch (Exception ex) { model.success = "false"; model.message = ex.Message; } return(this.Request.CreateResponse <ApplicationRolesViewModel>(HttpStatusCode.OK, model)); }