Esempio n. 1
0
        public async Task <User> DeleteUser(int id, CancellationToken cancellationToken)
        {
            var userEntity = await _iUserData.DeleteUser(id, cancellationToken);

            var result = _iMapper.Map <User>(userEntity);

            return(result);
        }
Esempio n. 2
0
        public JsonResult DeleteUser(Kullanicilar user)
        {
            _userData.DeleteUser(user.KullaniciId);

            return(Json(new Response {
                ErrorMessage = "Silinmiştir", IsSuccess = false
            }, JsonRequestBehavior.AllowGet));
        }
        public IActionResult DeleteUser(int Id)
        {
            var user = _userData.GetUser(Id);

            if (user != null)
            {
                _userData.DeleteUser(user);
                return(Ok($"user with Id : {Id} is deleted from Database"));
            }

            return(NotFound($"User with Id : {Id} was not found"));
        }
        public IActionResult DeleteUser(Guid id)
        {
            var user = _userData.GetUser(id);

            if (user != null)
            {
                _userData.DeleteUser(user);
                return(Ok());
            }

            return(NotFound("User with ID: " + id + " not found!"));
        }
        public async Task <IActionResult> DeleteUser([FromRoute] long id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var user = await _userData.GetUser(id);

            if (user == null)
            {
                return(NotFound());
            }

            await _userData.DeleteUser(id);

            return(Ok(user));
        }
Esempio n. 6
0
        private async void btnDelete_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Are you sure you want to delete user?", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                try
                {
                    var selectedUser = users[lsvUsers.FocusedItem.Index];
                    selectedUser.AccessType = cboAccess.Text.Trim();
                    await user.DeleteUser(selectedUser.Id);
                    await LoadAllUsers();

                    Logger.WriteToFile(Logger.FullName, $"Deleted the user {selectedUser.Name}");
                    MessageBox.Show("User has been successfully deleted", "Delete User", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception ex)
                {
                    MessageBox.Show($"Sorry an error occured. \n{ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Esempio n. 7
0
        public User processStart()
        {
            const string info = "Программа калькулятор:"
                                + "\nВыберите нужный пункт меню:\n 1. Регистрация нового пользователя"
                                + " \n 2. Войти в систему под пользователем"
                                + " \n 3. Удалить аккаунт \n4. Изменить пароль пользователя";
            //\n 3. Исправить данные пользователя \n 4. Удалить пользователя \n 5.Выход из программы";

            int operation;

            Console.WriteLine(info);
            do
            {
                Console.Write("Введите номер операции:");
                if (int.TryParse(Console.ReadLine(), out operation))
                {
                    if (operation >= 1 && operation <= 4)
                    {
                        break;
                    }
                    else
                    {
                        Console.WriteLine("Не корректные данные");
                    }
                }
            } while (true);

            switch (operation)
            {
            case 1:
            {
                this.user = InputeDataUser();
                if (!users.AddUser(user))
                {
                    user = null;
                }
                break;
            }

            case 2:
            {
                user = InputeDataUser();
                if (!user.Equals(users.GetUser(user.Name)))
                {
                    Console.WriteLine("Неверное имя пользователя или пароль!");
                    user = null;
                }
                break;
            }

            case 3:
            {
                user = InputeDataUser();
                if (user.Equals(users.GetUser(user.Name)))
                {
                    users.DeleteUser(user);
                }
                else
                {
                    Console.WriteLine("Такого юзера нет!");
                }
                user = null;
                break;
            }

            case 4:
            {
                user = InputeDataUser();
                if (user.Equals(users.GetUser(user.Name)))
                {
                    bool   validation_flag = false;
                    string password;
                    do
                    {
                        Console.WriteLine("Введите новый пароль:");
                        password = Console.ReadLine();
                        if (!ValidationData.isCorrectStringData(password, 3))
                        {
                            Console.WriteLine("Пароль должен быть не менее 3 символов");
                        }
                        else
                        {
                            validation_flag = true;
                        }
                    } while (!validation_flag);
                    users.EditUSer(user, password);
                }
                else
                {
                    user = null;
                    Console.WriteLine("Такого юзера нет!");
                }
                break;
            }
            }
            return(user);
        }
Esempio n. 8
0
 public void DeleteUser(int id)
 {
     _userdata.DeleteUser(id);
 }
Esempio n. 9
0
 public bool DeleteUser(int userid)
 {
     return(_userData.DeleteUser(userid));
 }
Esempio n. 10
0
 public bool DeleteUser(int id)
 {
     return(_dataUser.DeleteUser(id));
 }
 public JsonResult DeleteUser(int id)
 {
     try
     {
         return(Json(id <= 0 ? new { status = "Error", message = "Please provide valid ID" } : new { status = "Success", message = _userInformation.DeleteUser(id) }));
     }
     catch (Exception ex)
     {
         return(Json(new { status = "error", message = ex.Message }));
     }
 }
Esempio n. 12
0
 public ActionResult DeletePost(int id)
 {
     db.DeleteUser(id);
     TempData["Message"] = "User Deleted successfully";
     return(RedirectToAction("Index"));
 }
Esempio n. 13
0
 private static async Task <IResult> DeleteUser(int id, IUserData data)
 => await GetResult(async() =>
 {
     await data.DeleteUser(id);
     return(Results.Ok());
 });
Esempio n. 14
0
 public void Delete(int id)
 {
     userData.DeleteUser(id);
 }