示例#1
0
 public async Task <IActionResult> WriteOff(Books item)
 {
     try
     {
         _context.Update(item);
         await _context.SaveChangesAsync();
     }
     catch (DbUpdateConcurrencyException)
     {
         throw;
     }
     return(RedirectToAction(nameof(Index)));
 }
示例#2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Password,Email,Role")] Users users)
        {
            if (id != users.Id)
            {
                return(NotFound());
            }

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