public async Task <IActionResult> Create([Bind("Id,CateoryName,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,Surname,Address1,Address2,ZipCode,State,City,Phone,Email,RequestSend,RequestDeliveredIn")] Request request) { if (ModelState.IsValid) { _context.Add(request); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(request)); }
public async Task <IActionResult> Create([Bind("Id,Name,DescriptionShort,DescriptionDetailed,Price,ImageURL,ImageThumbnaiURL,Preferred,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)); }