public async Task <IActionResult> Create([Bind("Id,Name,CustomerSurname,Address,AddressComplement,CEP,State,City,Telephone,Email,SendDate,DeliveryDate")] 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,CategoryName,Description")] Category category) { if (ModelState.IsValid) { _context.Add(category); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(category)); }
public async Task <IActionResult> Create([Bind("Id,Name,SmallDescription,LongDescription,Price,ImgUrl,ImgThumbnailUrl,IsPreferSnack,InStock,CategoryId")] Snack snack) { if (ModelState.IsValid) { _context.Add(snack); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CategoryId"] = new SelectList(_context.Categories, "Id", "Id", snack.CategoryId); return(View(snack)); }