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())); }
public ActionResult AddProducttodb(SOUND_SYSTEM.Model.Product p) { mdi.Products.Add(p); return(View()); }