public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Postcode")] Apiary apiary)
        {
            if (id != apiary.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(apiary);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ApiaryExists(apiary.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(apiary));
        }
Beispiel #2
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Name")] Beehive beehive)
        {
            if (id != beehive.ID)
            {
                return(NotFound());
            }

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