public async Task <IActionResult> Create([Bind("EcoScoreId,Material,Removal,Reuse")] EcoScoreTally ecoScoreTally) { if (ModelState.IsValid) { _context.Add(ecoScoreTally); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(ecoScoreTally)); }
public async Task <IActionResult> Create([Bind("ItemId,UserName,Description,Photo,EcoScoreId")] ItemInfo itemInfo) { if (ModelState.IsValid) { _context.Add(itemInfo); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["EcoScoreId"] = new SelectList(_context.EcoScoreTally, "EcoScoreId", "Material", itemInfo.EcoScoreId); return(View(itemInfo)); }