public async Task <IEnumerable <Report> > GetListAsync() { var loggedInUserID = _userService.GetCurrentUserId(); CoreServiceDevReference.CoreServiceClient coreServiceClient = new CoreServiceDevReference.CoreServiceClient(); // TODO: access clients? var reportListingForUser = await coreServiceClient.GetReportsBySearchCriteriaAsync(null, null, null, null, null, false, false, null, null, int.Parse(loggedInUserID), null); var clientListingForUser = await coreServiceClient.GetAllClientListingForUserAsync(int.Parse(loggedInUserID)); //var clinicians = await coreServiceClient.GetClinicianListingsForUserAsync(int.Parse(loggedInUserID)); //var user = clinicians.Where(x=>x.OrgUserMappingKey == int.Parse(loggedInUserID)).Select(c => c.Name).SingleOrDefault(); var reportListing = reportListingForUser .Select(x => new Report { ClientId = x.ClientID, ClientName = x.ClientName, ReportName = x.ProductName, AssignedDate = x.DateAssigned, CompletedDate = x.DateCompleted, ReportKey = x.ReportKey }).ToList(); return(reportListing); }
public async Task <IEnumerable <Group> > GetListAsync() { var loggedInUserID = _userService.GetCurrentUserId(); CoreServiceDevReference.CoreServiceClient coreServiceClient = new CoreServiceDevReference.CoreServiceClient(); var groupListingForUser = await coreServiceClient.GetAllClientListingForUserAsync(int.Parse(loggedInUserID)); var groupListing = groupListingForUser.ClientGroups .Select(x => new Group { ClientGroupKey = x.ClientGroupKey, Name = x.Name, ClientCount = x.Clients.Count() // , // Clients = x.Clients.ToList() }); return(groupListing); }