public ActionResult Create(Store store) { if (ModelState.IsValid) { db.Stores.Add(store); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.ProductId = new SelectList(db.Products, "ProductId", "Code", store.ProductId); ViewBag.ProductUnitId = new SelectList(db.ProductUnits, "ProductUnitId", "Name", store.ProductUnitId); return View(store); }
public ActionResult Edit(Store store) { if (ModelState.IsValid) { db.Entry(store).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.ProductId = new SelectList(db.Products, "ProductId", "Code", store.ProductId); ViewBag.ProductUnitId = new SelectList(db.ProductUnits, "ProductUnitId", "Name", store.ProductUnitId); return View(store); }