Ejemplo n.º 1
0
        public ActionResult EditProduct(int?productId, int?categoryId, string productName, decimal?price, decimal?catererDiscount, int?restockAmount, HttpPostedFileBase image, bool?discontinued)
        {
            Product p = new Product();

            p.ProductName     = productName;
            p.Price           = (decimal)price;
            p.CatererDiscount = (decimal)catererDiscount;
            p.RestockAmount   = restockAmount;
            p.CategoryId      = (int)categoryId;
            if (image != null)
            {
                Guid g = Guid.NewGuid();
                image.SaveAs(Server.MapPath("~/Uploads/" + g + ".jpg"));
                p.Image = g + ".jpg";
            }
            else
            {
                p.Image = "";
            }
            p.Discontinued = discontinued;
            CakesPosRepository cpr = new CakesPosRepository(_connectionString);

            cpr.EditProduct(p, (int)productId);
            return(RedirectToAction("Inventory"));
        }