public async Task <ActionResult> Create([Bind(Include = "LocId,LocName,Notes")] Locations locations) { if (ModelState.IsValid) { db.Locations.Add(locations); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(locations)); }
public async Task <ActionResult> Create([Bind(Include = "ProdId,Item,Description,Qty,Cost,Price,LocId,ProvId,BrandId,LocationId,Warranty,DateAd")] Products products) { if (ModelState.IsValid) { db.Products.Add(products); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.LocationId = new SelectList(db.Locations, "LocId", "LocName", products.LocationId); return(View(products)); }