Пример #1
0
        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));
        }
Пример #2
0
        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));
        }