public CapabilityMappings GetAll() { return(GetInternal(() => { var retval = new CapabilityMappings(); var capStds = _capabilityStandardDatastore.GetAll(); var caps = _capabilitiesDatastore.GetAll(); var stds = _standardsDatastore.GetAll(); foreach (var cap in caps) { var thisCapMap = retval.CapabilityMapping.SingleOrDefault(x => x.Capability.Id == cap.Id); if (thisCapMap == null) { thisCapMap = new CapabilityMapping { Capability = cap }; var optStds = capStds .Where(cs => cs.CapabilityId == cap.Id) .Select(cs => new OptionalStandard { StandardId = cs.StandardId, IsOptional = cs.IsOptional }); thisCapMap.OptionalStandard.AddRange(optStds); retval.CapabilityMapping.Add(thisCapMap); } } retval.Standard.AddRange(stds); return retval; })); }
public virtual IActionResult ApiStandardsGet([FromQuery] int?pageIndex, [FromQuery] int?pageSize) { IEnumerable <Standard> standards; int totalPages; try { standards = _datastore.GetAll(); standards = _datastore.GetPagingValues(pageIndex, pageSize, standards, out totalPages); } catch (Crm.CrmApiException ex) { return(StatusCode((int)ex.HttpStatus, ex.Message)); } return(new ObjectResult(new PaginatedListStandards { Items = standards.ToList(), TotalPages = totalPages, PageIndex = pageIndex ?? Paging.DefaultIndex, PageSize = pageSize ?? Paging.DefaultPageSize, })); }
public IEnumerable <Standards> GetAll() { return(_datastore.GetAll()); }