示例#1
0
        public ActionResult addproduct(SOUND_SYSTEM.Model.Product p)
        {
            Category obj = mdi.Categories.Where(x => x.Name == p.Category).SingleOrDefault();


            obj.Qty++;



            mdi.Products.Add(p);

            mdi.SaveChanges();



            for (int i = 0; i < Request.Files.Count; i++)
            {
                string s = i.ToString();


                string             concat = p.Name + s;
                HttpPostedFileBase file1  = Request.Files[i];
                file1.SaveAs(Server.MapPath(@"~\images\product\" + concat + ".jpg"));
            }



            return(View("Manage", mdi.Categories.ToList()));
        }
示例#2
0
        public ActionResult AddProducttodb(SOUND_SYSTEM.Model.Product p)
        {
            mdi.Products.Add(p);

            return(View());
        }