Beispiel #1
0
        public async Task <IActionResult> Edit(Guid id, [Bind("DexNumber,Name,TypeOne,TypeTwo,Nature")] Fakemon fakemon)
        {
            if (id != fakemon.DexNumber)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(fakemon);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FakemonExists(fakemon.DexNumber))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(fakemon));
        }
Beispiel #2
0
        public async Task <IActionResult> Create([Bind("DexNumber,Name,TypeOne,TypeTwo,Nature")] Fakemon fakemon)
        {
            if (ModelState.IsValid)
            {
                fakemon.DexNumber = Guid.NewGuid();
                _context.Add(fakemon);
                await _context.SaveChangesAsync();

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