Exemple #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ItemId,UserName,Description,Photo,EcoScoreId")] ItemInfo itemInfo)
        {
            if (id != itemInfo.ItemId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(itemInfo);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ItemInfoExists(itemInfo.ItemId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EcoScoreId"] = new SelectList(_context.EcoScoreTally, "EcoScoreId", "Material", itemInfo.EcoScoreId);
            return(View(itemInfo));
        }
Exemple #2
0
        public async Task <IActionResult> Edit(int id, [Bind("EcoScoreId,Material,Removal,Reuse")] EcoScoreTally ecoScoreTally)
        {
            if (id != ecoScoreTally.EcoScoreId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(ecoScoreTally);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EcoScoreTallyExists(ecoScoreTally.EcoScoreId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(ecoScoreTally));
        }