Esempio n. 1
0
        public ActionResult New(ProductAddEditVM productmodel)
        {
            Product product = productmodel.toProduct();

            if (ModelState.IsValid)
            {
                if (product.Id == 0)
                {
                    _ProductRepository.Add(product);
                }
                else
                {
                    _ProductRepository.Edit(product);
                }


                return(RedirectToAction("Index"));
            }
            var types = _ProductTypeRepository.FindAll();

            ViewBag.Types = types;
            return(View(product));
        }