Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Year,Count")] MangoCount mangoCount)
        {
            if (id != mangoCount.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(mangoCount);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MangoCountExists(mangoCount.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(mangoCount));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("Id,Year,Count")] MangoCount mangoCount)
        {
            if (ModelState.IsValid)
            {
                _context.Add(mangoCount);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(mangoCount));
        }