public async Task <IActionResult> Edit(int id, [Bind("EcoscoreId,ObjectName,Description,Reuse,Reduce,Recycle,Photo,Ecoscore1")] EcoScore ecoScore) { if (id != ecoScore.EcoscoreId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(ecoScore); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EcoScoreExists(ecoScore.EcoscoreId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(ecoScore)); }
public async Task <IActionResult> Create([Bind("EcoscoreId,ObjectName,Description,Reuse,Reduce,Recycle,Photo,Ecoscore1")] EcoScore ecoScore) { if (ModelState.IsValid) { _context.Add(ecoScore); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(ecoScore)); }