Esempio n. 1
0
        public IActionResult Modify(long id, string name, string shortDescription, string longDescription, decimal price, int category)
        {
            bool created;

            if (id < 1)
            {
                //insert new product
                id      = DataAccessModel.AddProduct(name, shortDescription, longDescription, price, category);
                created = true;
            }
            else
            {
                //update existing product
                DataAccessModel.UpdateProduct(id, name, shortDescription, longDescription, price, category);
                created = false;
            }

            //redirect to summary page
            return(RedirectToAction("Summary", "Admin", new { created, id }));
        }