private void UpdateDataGrid() { BasketDtos = _mapper.Map <List <Basket>, List <UniversalBasketDTO> >(_basketService.GetAll()); BasketDtos.Sort(delegate(UniversalBasketDTO x, UniversalBasketDTO y) { return(x.Id.CompareTo(y.Id)); }); BasketOwnDtos = _mapper.Map <List <BasketOwn>, List <UniversalBasketDTO> >(_basketOwnService.GetAll()); BasketOwnDtos.Sort(delegate(UniversalBasketDTO x, UniversalBasketDTO y) { return(x.Id.CompareTo(y.Id)); }); UniversalBasketDtos = BasketDtos.Where(item => item.CheckNumber == _currentSale.CheckNumber).ToList(); UniversalBasketDtos.AddRange(BasketOwnDtos.Where(item => item.CheckNumber == _currentSale.CheckNumber) .ToList()); _saleService.Refresh(_currentSale); _currentSale = _saleService.GetId(_currentSale.Id); DateLabel.Content = _currentSale.Date.ToString(); TotalLabel.Content = $"{_currentSale.Total,0:C2}"; DataGrid.ItemsSource = UniversalBasketDtos; }
private void UpdateDataGrid() { BasketDtos = _mapper.Map <List <Basket>, List <UniversalBasketDTO> >(_basketService.GetAll()); BasketDtos.Sort(delegate(UniversalBasketDTO x, UniversalBasketDTO y) { return(x.Id.CompareTo(y.Id)); }); BasketOwnDtos = _mapper.Map <List <BasketOwn>, List <UniversalBasketDTO> >(_basketOwnService.GetAll()); BasketOwnDtos.Sort(delegate(UniversalBasketDTO x, UniversalBasketDTO y) { return(x.Id.CompareTo(y.Id)); }); UniversalBasketDtos = BasketDtos.Where(item => item.CheckNumber == _currentSale.CheckNumber).ToList(); UniversalBasketDtos.AddRange(BasketOwnDtos.Where(item => item.CheckNumber == _currentSale.CheckNumber) .ToList()); DataGrid.ItemsSource = UniversalBasketDtos; }