예제 #1
0
        public async Task <IActionResult> Edit(long id, [Bind("Id,OwnerId,RowLabel,ColLabel,ColNumbers,RowNumbers")] Board board)
        {
            if (id != board.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(board);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BoardExists(board.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["OwnerId"] = new SelectList(_context.Owners, "Id", "Id", board.OwnerId);
            return(View(board));
        }
예제 #2
0
        public async Task <IActionResult> Edit(long id, [Bind("Id,EmailAddress")] Owner owner)
        {
            if (id != owner.Id)
            {
                return(NotFound());
            }

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