public async Task <IActionResult> ListData(int skip, int take) { var request = new SuperAdminUserReadListRequest(CurrentUser.Id); SetPaging(skip, take, request); var response = await _adminService.GetSuperAdmins(request); if (response.Status.IsNotSuccess) { return(NotFound()); } var result = new DataResult(); result.AddHeaders("user_name", "is_active", ""); for (var i = 0; i < response.Items.Count; i++) { var item = response.Items[i]; var stringBuilder = new StringBuilder(); stringBuilder.Append($"{item.Uid}{DataResult.SEPARATOR}"); stringBuilder.Append($"{result.PrepareLink($"/User/Detail/{item.Uid}", item.FirstName)}{DataResult.SEPARATOR}"); stringBuilder.Append($"{item.IsActive}{DataResult.SEPARATOR}"); stringBuilder.Append($"{result.PrepareChangeActivationButton("/Admin/ChangeActivation/")}"); stringBuilder.Append($"{result.PrepareButton("degrade_to_user", "handleDegradeToUser(this, \"/Admin/DegradeToUser/\")", "btn-secondary", "are_you_sure_you_want_to_degrade_to_user_title", "are_you_sure_you_want_to_degrade_to_user_content")}{DataResult.SEPARATOR}"); result.Data.Add(stringBuilder.ToString()); } result.PagingInfo = response.PagingInfo; result.PagingInfo.Type = PagingInfo.PAGE_NUMBERS; return(Json(result)); }
public async Task <IActionResult> OrganizationListData(int skip, int take) { var request = new OrganizationReadListRequest(CurrentUser.Id); SetPaging(skip, take, request); var response = await OrganizationService.GetOrganizations(request); if (response.Status.IsNotSuccess) { return(NotFound()); } var result = new DataResult(); result.AddHeaders("organization_name", "user_count", "project_count", "label_count", "label_translation_count", "is_active", ""); for (var i = 0; i < response.Items.Count; i++) { var item = response.Items[i]; var stringBuilder = new StringBuilder(); stringBuilder.Append($"{item.Uid}{DataResult.SEPARATOR}"); stringBuilder.Append($"{result.PrepareLink($"/Organization/Detail/{item.Uid}", item.Name, true)}{DataResult.SEPARATOR}"); stringBuilder.Append($"{item.UserCount}{DataResult.SEPARATOR}"); stringBuilder.Append($"{item.ProjectCount}{DataResult.SEPARATOR}"); stringBuilder.Append($"{item.LabelCount}{DataResult.SEPARATOR}"); stringBuilder.Append($"{item.LabelTranslationCount}{DataResult.SEPARATOR}"); stringBuilder.Append($"{item.IsActive}{DataResult.SEPARATOR}"); stringBuilder.Append($"{result.PrepareChangeActivationButton("/Admin/OrganizationChangeActivation/")}{DataResult.SEPARATOR}"); result.Data.Add(stringBuilder.ToString()); } result.PagingInfo = response.PagingInfo; result.PagingInfo.Type = PagingInfo.PAGE_NUMBERS; return(Json(result)); }