public async Task <IActionResult> Create([Bind("Id,Name,Description")] SnackCategory snackCategory) { if (ModelState.IsValid) { _context.Add(snackCategory); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(snackCategory)); }
public async Task <IActionResult> Create([Bind("OrderId,Name,SirName,Address,AddressComplement,PostalCode,Province,City,PhoneNumber,EmailAddress,Total,OrderDate,DepartureTime,DeliveredTime")] Order order) { if (ModelState.IsValid) { _context.Add(order); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(order)); }
public async Task <IActionResult> Create([Bind("Id,Name,Price,ShortDescription,LongDescription,MainImage,MainThumbnail,IsStarred,IsAvailable,SnackCategoryId")] Snack snack) { if (ModelState.IsValid) { _context.Add(snack); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["SnackCategoryId"] = new SelectList(_context.SnackCategories, "Id", "Name", snack.SnackCategoryId); return(View(snack)); }