Example #1
0
 public ActionResult Edit(EditProductForm form)
 {
     return(this.Handle(form)
            .With(x => this.productRepository.Save(new Product()
     {
         Name = form.Name,
         Price = form.Price.ToDecimal2()
     }))
            .OnFailure(x => View("Edit", form))
            .OnSuccess(x => RedirectToAction("Index"), "Product {0} was saved", form.Name));
 }
Example #2
0
 public ActionResult Edit(EditProductForm form)
 {
     return this.Handle(form)
         .With(x => this.productRepository.Save(new Product()
         {
             Name = form.Name,
             Price = form.Price.ToDecimal2()
         }))
         .OnFailure(x => View("Edit", form))
         .OnSuccess(x => RedirectToAction("Index"), "Product {0} was saved", form.Name);
 }
Example #3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            var product = new Product();

            var dialogResult = new EditProductForm(product, _gService.GetAll()).ShowDialog();

            if (dialogResult == DialogResult.OK)
            {
                _prService.Add(product);
                MetroMessageBox.Show(this, $"Игра {product.Title} успешно создан", "Справка", MessageBoxButtons.OK, MessageBoxIcon.Information);
                UpdateDataGrid();
                UpdateCounter();
            }
        }
Example #4
0
        private void editProduct()
        {
            var editProduct = SelectedProduct;

            editProductForm             = new EditProductForm(editProduct);
            editProductForm.MaximizeBox = false;
            editProductForm.MinimizeBox = false;
            editProductForm.ShowDialog();

            using (var db = new WereDesktopEntities())
            {
                productBindingSource.DataSource = db.Product.ToList();
            }
        }
Example #5
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            var product = _prService.Find(Convert.ToInt32(dataGrid.SelectedRows[0].Cells[0].Value));

            if (product != null)
            {
                var dialogResult = new EditProductForm(product, _gService.GetAll()).ShowDialog();

                if (dialogResult == DialogResult.OK)
                {
                    _prService.Update(product);
                    MetroMessageBox.Show(this, $"Игра {product.Title} изменена", "Справка", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    UpdateDataGrid();
                    UpdateCounter();
                }
            }
        }
Example #6
0
 private void btnEditProduct_Click(object sender, EventArgs e)
 {
     try
     {
         int             index       = metroGridInventory.CurrentCell.RowIndex;
         DataGridViewRow selectedRow = metroGridInventory.Rows[index];
         int             id          = Convert.ToInt32(selectedRow.Cells[0].Value);
         Data.Product    product     = Program.User.Inventory.GetProduct(id);
         EditProductForm form        = new EditProductForm(product);
         form.StyleManager = Program.MainStyleManager;
         if (form.ShowDialog() == DialogResult.OK)
         {
             MetroMessageBox.Show(this, "You successfully saved product changes!", "Edit product", MessageBoxButtons.OK, 150);
             RefreshPrivControls();
         }
     }
     catch
     {
         MainForm form = (MainForm)Parent;
         form.NotifText = "Select product first";
     }
 }
Example #7
0
        private void editProduct_MouseClick(object sender, MouseEventArgs e)
        {
            EditProductForm product = new EditProductForm();

            product.ShowDialog();
        }