public async Task <ActionResult> FillInventory(Inventory inventory) { using (var context = new Farmazon_dbEntities()) { var userId = HttpContext.GetOwinContext().Authentication.User.Identity.GetUserId(); context.CreateInventoryItem(userId, inventory.Quantity, inventory.Price, inventory.ProductName, inventory.PhotoLocation, inventory.Description, inventory.ReviewCount, inventory.ReviewStars); await context.SaveChangesAsync(); return(new HttpStatusCodeResult((int)HttpStatusCode.OK)); } }
public async Task <ActionResult> FillInventory(Inventory inventory) { if (ModelState.IsValid) { using (var context = new Farmazon_dbEntities()) { var userId = HttpContext.GetOwinContext().Authentication.User.Identity.GetUserId(); context.CreateInventoryItem(userId, inventory.Quantity, inventory.Price, inventory.ProductName, inventory.PhotoLocation, inventory.Description, inventory.ReviewCount, inventory.ReviewStars); await context.SaveChangesAsync(); return(RedirectToAction("GetInventory", "Account")); } } return(View(inventory)); }