public async Task <User> DeleteUser(int id, CancellationToken cancellationToken) { var userEntity = await _iUserData.DeleteUser(id, cancellationToken); var result = _iMapper.Map <User>(userEntity); return(result); }
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)); }
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); } } }
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); }
public void DeleteUser(int id) { _userdata.DeleteUser(id); }
public bool DeleteUser(int userid) { return(_userData.DeleteUser(userid)); }
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 })); } }
public ActionResult DeletePost(int id) { db.DeleteUser(id); TempData["Message"] = "User Deleted successfully"; return(RedirectToAction("Index")); }
private static async Task <IResult> DeleteUser(int id, IUserData data) => await GetResult(async() => { await data.DeleteUser(id); return(Results.Ok()); });
public void Delete(int id) { userData.DeleteUser(id); }