Beispiel #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (!_isChanged)
                {
                    return;
                }

                if (!ValidateModel())
                {
                    return;
                }

                SetModel();

                if (_isAddNewMode)
                {
                    _productPrice.Id = _productPriceService.Insert(_productPrice);
                }
                else
                {
                    _productPriceService.Update(_productPrice);
                }

                LoadFormWithData();
                MessageBox.Show(POSText.SaveMessage, MessageBoxCaptions.Success.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception exception)
            {
                MessageBox.Show(POSText.ErrorMessage, MessageBoxCaptions.Error.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public ActionResult Create([Bind(Include = "Id,ProductId,DateOfPrice,PriceWithoutDiscount,PriceWithDiscount")] ProductPriceDto productPrice)
        {
            if (ModelState.IsValid)
            {
                _productPriceService.Insert(productPrice);
                return(RedirectToAction("List"));
            }

            ViewBag.ProductId = new SelectList(_productService.Get(), "Id", "Summary", productPrice.ProductId);
            return(View(productPrice));
        }