public async Task <Crust> Create(Crust item) { _context.Crusts.Add(item); await _context.SaveChangesAsync(); return(item); }
public async Task <IActionResult> Create([Bind("Id,Topping,Price,Amount,Type")] Ingredients ingredients) { if (ModelState.IsValid) { _context.Add(ingredients); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(ingredients)); }
public async Task <IActionResult> Create([Bind("Id,OrderId,Amount")] Pizza pizza) { if (ModelState.IsValid) { _context.Add(pizza); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["OrderId"] = new SelectList(_context.Orders, "Id", "Id", pizza.OrderId); return(View(pizza)); }
public async Task <IActionResult> Create([Bind("Id,PizzaId,IngredientId,Finished")] PizzaIngredients pizzaIngredients) { if (ModelState.IsValid) { _context.Add(pizzaIngredients); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["IngredientId"] = new SelectList(_context.Ingredients, "Id", "Topping", pizzaIngredients.IngredientId); ViewData["PizzaId"] = new SelectList(_context.Pizza, "Id", "Id", pizzaIngredients.PizzaId); return(View(pizzaIngredients)); }
public async Task <IActionResult> Create([Bind("Id,TotalPrice,OrderStatus,PlaceDate,DeliveryDate,StoreId,EmployeeId,CustomerId")] Orders orders) { if (ModelState.IsValid) { _context.Add(orders); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CustomerId"] = new SelectList(_context.Customer, "Id", "FirstName", orders.CustomerId); ViewData["EmployeeId"] = new SelectList(_context.Employee, "Id", "Username", orders.EmployeeId); ViewData["StoreId"] = new SelectList(_context.Store, "Id", "Id", orders.StoreId); return(View(orders)); }