public async Task <IActionResult> Create([Bind("Id,Name,ImageUrl")] 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,Description,Price,ImageUrl,CategoryId,ClimateCompensated")] Clothing clothing) { if (ModelState.IsValid) { _context.Add(clothing); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CategoryId"] = new SelectList(_context.Set <Category>(), "Id", "Id", clothing.CategoryId); return(View(clothing)); }