示例#1
0
        public async Task<IActionResult> Edit(long id, [Bind("Id,Name,UserName,Password,AdditionDate")] User user)
        {
            if (id != user.Id)
            {
                return NotFound();
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(user);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserExists(user.Id))
                    {
                        return NotFound();
                    }
                    else
                    {
                        throw;
                    }
                }
                return RedirectToAction(nameof(Index));
            }
            return View(user);
        }
示例#2
0
 public void UpdatePlaylist(PlayList playList)
 {
     _context.Update(playList);
     _context.SaveChanges();
 }