private void AddLot_OnClick(object sender, RoutedEventArgs e)// Добавить лот в базу и карточки и отсортировать карточки { using (var uow = new AuctionUnitOfWork(true)) { var user = uow.UserRepository.Get(_userId); var selectedProduct = (Product)ProductComboBox.SelectedItem; var product = uow.ProductRepository.Get(selectedProduct.Id); var lot = new Lot { Title = TitleTextBox.Text, StartBid = decimal.Parse(StartBidTextBox.Text), CurrentBid = decimal.Parse(StartBidTextBox.Text), MinBidStep = decimal.Parse(MinStepTextBox.Text), DateCreated = DateTime.Now, DateToExpire = new DateTime(2019, 11, 11), Users = new List <User> { user }, Product = product, ProductId = product.Id }; uow.LotRepository.Add(lot); uow.Commit(); } LotListControl.RefreshAndSort(l => l.Id); ClearForm(); }
private void EditLot_OnClick(object sender, RoutedEventArgs e) { using (var uow = new AuctionUnitOfWork(true)) // Обновить лот { var lot = uow.LotRepository.Get(_currentLot.Id); var selectedProduct = (Product)ProductComboBox.SelectedItem; var product = uow.ProductRepository.Get(selectedProduct.Id); lot.Title = TitleTextBox.Text; lot.StartBid = decimal.Parse(StartBidTextBox.Text); lot.MinBidStep = decimal.Parse(MinStepTextBox.Text); lot.ProductId = product.Id; lot.Product = product; uow.LotRepository.Update(lot); uow.Commit(); } LotListControl.RefreshAndSort(l => l.Id); ClearForm(); }
private void SortByBid_OnClick(object sender, RoutedEventArgs e) { LotListControl.RefreshAndSort(l => l.StartBid); }
private void SortByTitle_OnClick(object sender, RoutedEventArgs e) { LotListControl.RefreshAndSort(l => l.Title); }