public async Task <IActionResult> Edit(int id, [Bind("UserId,FullName,ObjectName,Description,Reuse,Reduce,Recycle,Photo,Ecoscore,EcoscoreId")] UserSelection userSelection) { if (id != userSelection.UserId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(userSelection); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserSelectionExists(userSelection.UserId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["EcoscoreId"] = new SelectList(_context.EcoScore.OrderBy(c => c.EcoscoreId), "EcoscoreId", "EcoscoreId", userSelection.EcoscoreId); ViewData["objectName"] = new SelectList(_context.EcoScore, "objectName", "objectName", userSelection.ObjectName); return(View(userSelection)); }
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)); }