Пример #1
0
        public IActionResult Edit(long id, [Bind("UserName,Email,Password,Id,AddedDate,ModifiedDate,IPAddress")] User user)
        {
            if (id != user.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _userRepository.Update(user);
                    _userRepository.SaveChanges();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserExists(user.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
Пример #2
0
 public void UpdateUser(User user)
 {
     _userRepository.Update(user);
 }