public async Task <IActionResult> GetOperationsSummary(Guid tenantId) { var tenant = await _tenantService.GetAsync(tenantId); var utcNow = DateTimeOffset.UtcNow; var opsSummaryDto = new TenantOperationsSummaryDto { Id = tenant.Id.ToString(), Name = tenant.Name, ServiceExpireDate = tenant.ServiceDetails.ServiceExpireDate, ServiceMaxUsers = tenant.ServiceDetails.ServiceMaxUsers, ServiceMaxEmployees = tenant.ServiceDetails.ServiceMaxEmployees, ServiceActualUsers = await _accountService.GetUserCountInTenantAsync(tenantId), ServiceActualEmployees = await _employeeService.GetItemCountInTenantAsync(tenantId), BranchOfficesCount = await _branchOfficeService.GetItemCountInTenantAsync(tenantId), DepartmentsCount = await _departmentService.GetItemCountInTenantAsync(tenantId), NewInspectionsLast24Hours = await _inspectionService.GetInspectionCountSinceAsync(tenantId, utcNow - TimeSpan.FromHours(24)), NewInspectionsLastWeek = await _inspectionService.GetInspectionCountSinceAsync(tenantId, utcNow - TimeSpan.FromDays(7)) }; return(Ok(opsSummaryDto)); }