/// <summary> /// Gets the list of items to show in the table, according to the specifed first and max items. /// </summary> /// <returns></returns> protected override IList <DepartmentSummary> ListItems(ListDepartmentsRequest request) { ListDepartmentsResponse listResponse = null; Platform.GetService <IDepartmentAdminService>( service => listResponse = service.ListDepartments(request)); return(listResponse.Departments); }
public override async Task <ListDepartmentsResponse> ListDepartments(ListDepartmentsRequest request, ServerCallContext context) { var departments = await _organizationApp.GetDepartmentsAsync(); var items = departments.Select(x => new ListDepartmentsResponse.Types.Department { Id = x.Id, Name = x.Name, ParentId = x.ParentId, }); var result = new ListDepartmentsResponse(); result.Items.AddRange(items); return(result); }
public static ListDepartmentsResponse Unmarshall(UnmarshallerContext _ctx) { ListDepartmentsResponse listDepartmentsResponse = new ListDepartmentsResponse(); listDepartmentsResponse.HttpResponse = _ctx.HttpResponse; listDepartmentsResponse.Code = _ctx.StringValue("ListDepartments.Code"); listDepartmentsResponse.Message = _ctx.StringValue("ListDepartments.Message"); listDepartmentsResponse.RequestId = _ctx.StringValue("ListDepartments.RequestId"); ListDepartmentsResponse.ListDepartments_Data data = new ListDepartmentsResponse.ListDepartments_Data(); data.TotalElements = _ctx.LongValue("ListDepartments.Data.TotalElements"); data.TotalPages = _ctx.IntegerValue("ListDepartments.Data.TotalPages"); List <ListDepartmentsResponse.ListDepartments_Data.ListDepartments_ItemsItem> data_items = new List <ListDepartmentsResponse.ListDepartments_Data.ListDepartments_ItemsItem>(); for (int i = 0; i < _ctx.Length("ListDepartments.Data.Items.Length"); i++) { ListDepartmentsResponse.ListDepartments_Data.ListDepartments_ItemsItem itemsItem = new ListDepartmentsResponse.ListDepartments_Data.ListDepartments_ItemsItem(); itemsItem.CreatedAt = _ctx.StringValue("ListDepartments.Data.Items[" + i + "].CreatedAt"); itemsItem.Description = _ctx.StringValue("ListDepartments.Data.Items[" + i + "].Description"); itemsItem.Id = _ctx.StringValue("ListDepartments.Data.Items[" + i + "].Id"); itemsItem.Name = _ctx.StringValue("ListDepartments.Data.Items[" + i + "].Name"); itemsItem.UpdatedAt = _ctx.StringValue("ListDepartments.Data.Items[" + i + "].UpdatedAt"); List <ListDepartmentsResponse.ListDepartments_Data.ListDepartments_ItemsItem.ListDepartments_AdministratorsItem> itemsItem_administrators = new List <ListDepartmentsResponse.ListDepartments_Data.ListDepartments_ItemsItem.ListDepartments_AdministratorsItem>(); for (int j = 0; j < _ctx.Length("ListDepartments.Data.Items[" + i + "].Administrators.Length"); j++) { ListDepartmentsResponse.ListDepartments_Data.ListDepartments_ItemsItem.ListDepartments_AdministratorsItem administratorsItem = new ListDepartmentsResponse.ListDepartments_Data.ListDepartments_ItemsItem.ListDepartments_AdministratorsItem(); administratorsItem.Id = _ctx.StringValue("ListDepartments.Data.Items[" + i + "].Administrators[" + j + "].Id"); administratorsItem.Name = _ctx.StringValue("ListDepartments.Data.Items[" + i + "].Administrators[" + j + "].Name"); itemsItem_administrators.Add(administratorsItem); } itemsItem.Administrators = itemsItem_administrators; data_items.Add(itemsItem); } data.Items = data_items; listDepartmentsResponse.Data = data; return(listDepartmentsResponse); }