/// <summary> /// Loads the data /// </summary> /// <returns></returns> public override async Task LoadDataGridData() { _specRepo = new SpecificationRepository(); // Gets all the specifications, and maps it to objects fit to display in the datagrid SpecList = new ObservableCollection <SpecificationOverviewItem> (EntitiesMapping.MapToSpecificationOverviewItem(await _specRepo.GetAllAsync(), _preferredLanguage.ID) .OrderBy(x => x.SpecName).ToList()); BindData(); }
private async Task FillSelectionDataGrid() { // Gets all the specs from the database List <Specification> specs = await _specRepo.GetAllAsync(); // Gets the localized specifications, according to the preferred display language of the user List <LocalizedSpecification> locspecs = new List <LocalizedSpecification>(); foreach (var spec in specs) { locspecs.Add(spec.LocalizedSpecifications.SingleOrDefault(x => x.LanguageID == _preferredLanguage.ID)); } // Make an observable collection of the localized specifications, so it can be used to display in the datagrid SelectionSpecList = new ObservableCollection <LocalizedSpecification>(locspecs); BindSpecificationSelectionData(); }