private DateTime GetLatestLastUpdated(ISolutionResult solutionResult, IEnumerable <IMarketingContactResult> contactResult) => new List <DateTime> { solutionResult.LastUpdated, solutionResult.SolutionDetailLastUpdated, contactResult?.Any() == false ? DateTime.MinValue : contactResult.Max(x => x.LastUpdated) } .Max();
private static DateTime GetLatestLastUpdated(ISolutionResult solutionResult, IList <IMarketingContactResult> contactResult) => new List <DateTime> { solutionResult.LastUpdated, solutionResult.SolutionDetailLastUpdated, contactResult?.Any() == true?contactResult.Max(x => x.LastUpdated) : DateTime.MinValue } .Max();
/// <summary> /// Initialises a new instance of the <see cref="Solution" /> class. /// </summary> internal Solution( ISolutionResult solutionResult, IEnumerable <ISolutionCapabilityListResult> solutionCapabilityListResult, IEnumerable <IMarketingContactResult> contactResult, ISolutionSupplierResult solutionSupplierResult, IDocumentResult documentResult, IEnumerable <ISolutionEpicListResult> solutionEpicListResults) { var contactResultList = contactResult.ToList(); var solutionEpicsByCapability = solutionEpicListResults?.ToLookup(e => e.CapabilityId); Id = solutionResult.Id; Name = solutionResult.Name; LastUpdated = GetLatestLastUpdated(solutionResult, contactResultList); Summary = solutionResult.Summary; Description = solutionResult.Description; Features = string.IsNullOrWhiteSpace(solutionResult.Features) ? new List <string>() : JsonConvert.DeserializeObject <IEnumerable <string> >(solutionResult.Features); Integrations = new Integrations { Url = solutionResult.IntegrationsUrl, DocumentName = documentResult?.IntegrationDocumentName }; ImplementationTimescales = new ImplementationTimescales { Description = solutionResult.ImplementationTimescales }; AboutUrl = solutionResult.AboutUrl; RoadMap = new RoadMap { Summary = solutionResult.RoadMap, DocumentName = documentResult?.RoadMapDocumentName }; ClientApplication = string.IsNullOrWhiteSpace(solutionResult.ClientApplication) ? new ClientApplication() : JsonConvert.DeserializeObject <ClientApplication>(solutionResult.ClientApplication); IsFoundation = solutionResult.IsFoundation; Capabilities = solutionCapabilityListResult.Select(c => new ClaimedCapability(c, solutionEpicsByCapability?[c.CapabilityId])); Contacts = contactResultList.Select(c => new Contact(c)); PublishedStatus = solutionResult.PublishedStatus; Hosting = string.IsNullOrWhiteSpace(solutionResult.Hosting) ? new Hosting() : JsonConvert.DeserializeObject <Hosting>(solutionResult.Hosting); Supplier = solutionSupplierResult != null ? new SolutionSupplier(solutionSupplierResult) : new SolutionSupplier(); SolutionDocument = new SolutionDocument(documentResult?.SolutionDocumentName); }
internal Solution(ISolutionResult solutionResult, IEnumerable <ISolutionCapabilityListResult> solutionCapabilityListResult, IEnumerable <IMarketingContactResult> contactResult) { Id = solutionResult.Id; Name = solutionResult.Name; LastUpdated = GetLatestLastUpdated(solutionResult, contactResult); Summary = solutionResult.Summary; OrganisationName = solutionResult.OrganisationName; Description = solutionResult.Description; Features = string.IsNullOrWhiteSpace(solutionResult.Features) ? new List <string>() : JsonConvert.DeserializeObject <IEnumerable <string> >(solutionResult.Features); AboutUrl = solutionResult.AboutUrl; ClientApplication = string.IsNullOrWhiteSpace(solutionResult.ClientApplication) ? new ClientApplication() : JsonConvert.DeserializeObject <ClientApplication>(solutionResult.ClientApplication); IsFoundation = solutionResult.IsFoundation; Capabilities = new HashSet <string>(solutionCapabilityListResult.Select(c => c.CapabilityName)); Contacts = contactResult.Select(c => new Contact(c)); PublishedStatus = solutionResult.PublishedStatus; }