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 CreateBtn_OnClick(object sender, RoutedEventArgs e)
        {
            if (!ValidateForm())
            {
                return;
            }
            if (OwnCheckBox.IsChecked == true)
            {
                if (UniversalBasketDtos.FirstOrDefault(item =>
                                                       item.ProductCode == ProductCodeTextBox.Text && item.IsOwn) != null)
                {
                    MessageBox.Show("There is such goods in basket already!");
                    return;
                }

                var basketOwn = new BasketOwn();
                GoodsInMarketOwn tempGimo;
                basketOwn.Id     = BasketOwnDtos[^ 1]?.Id + 1 ?? 1;
        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;
        }