Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Color,Region,ImageLocation")] Bird bird)
        {
            if (id != bird.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(bird);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BirdExists(bird.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(bird));
        }
Пример #2
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Bird,Description,ImageLocation,DateSeen")] UsersBirds usersBirds)
        {
            if (id != usersBirds.ID)
            {
                return(NotFound());
            }

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