public async Task <IActionResult> Edit(string id, [Bind("MakeYourOwnId,Topping,Sauce,Crust")] MakeYourOwn makeYourOwn) { if (id != makeYourOwn.MakeYourOwnId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(makeYourOwn); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MakeYourOwnExists(makeYourOwn.MakeYourOwnId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(makeYourOwn)); }
public async Task <IActionResult> Edit(int id, [Bind("MakeYourOwnID,Topping1,Topping2,Topping3,Topping4,Topping5,Topping6,Sauce,Crust,CustomerName")] MakeYourOwn makeYourOwn) { if (id != makeYourOwn.MakeYourOwnID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(makeYourOwn); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MakeYourOwnExists(makeYourOwn.MakeYourOwnID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(makeYourOwn)); }// GET: MakeYourOwns/Order/5
public async Task <IActionResult> Create([Bind("MakeYourOwnId,Topping,Sauce,Crust")] MakeYourOwn makeYourOwn) { if (ModelState.IsValid) { _context.Add(makeYourOwn); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(makeYourOwn)); }
public async Task <IActionResult> Create(MakeYourOwn makeYourOwn) { var user = await _userManager.GetUserAsync(User); if (ModelState.IsValid) { makeYourOwn.CustomerName = user.UserName; _context.Add(makeYourOwn); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(makeYourOwn)); }