Esempio n. 1
0
        public async Task HandleAsync(InsertProduct @event)
        {
            _context.Products.Add(@event.Product);

            await _context.SaveChangesAsync();

            var savedProductEvent = new SavedProduct(@event.Product.Id);
            await _eventBus.PublishAsync(savedProductEvent);
        }
Esempio n. 2
0
        public void Handle(InsertProduct @event)
        {
            _context.Products.Add(@event.Product);

            _context.SaveChanges();

            var savedProductEvent = new SavedProduct(@event.Product.Id);

            _eventBus.Publish(savedProductEvent);
        }
 private void EnterAmount()
 {
     if (!TextBoxEnter.Text.Equals(""))
     {
         try
         {
             ResetDataContextCalcu();
             var value = Convert.ToDecimal(TextBoxEnter.Text);
             if (VoedingsstoffenListView.SelectedItem != null)
             {
                 SavedProduct calculateProduct = Calculator.Calculate((Product)VoedingsstoffenListView.SelectedItem, value);
                 _calculateProducts.Add(calculateProduct);
                 ListViewCalcu.DataContext = _calculateProducts;
                 ResetTextboxes();
                 ResetDataContextVoedingsstoffen();
             }
         }
         catch (FormatException)
         {
             MessageBox.Show("Voer een decimaal of geheel getal in");
             TextBoxEnter.Text = "";
         }
     }
 }