/// <summary> /// Method for searching for specified user /// </summary> /// <param name="admin">Takes a user with admin priviliges</param> private static void SearchForUser(User admin) { AdminView.SearchForUser(admin); var searchKeyword = SharedController.GetSearchInput(); var listWithUsers = api.FindUser(admin.Id, searchKeyword); if (listWithUsers.Count > 0) { var continueLoop = true; do { AdminView.ListAllUsers(listWithUsers); var input = SharedController.GetAndValidateInput(); if (input.validatedInput == 0 || input.validatedInput > listWithUsers.Count) { SharedError.PrintWrongMenuInput(); } else { EditUser(admin, listWithUsers[input.validatedInput - 1]); continueLoop = false; } } while (continueLoop); } else { SharedError.NothingFound(); } }
/// <summary> /// Lists all users /// </summary> /// <param name="admin">Takes a user with admin priviliges</param> private static void ListAllUsers(User admin) { var listWithUsers = api.ListUsers(admin.Id); var continueLoop = true; do { Console.Clear(); AdminView.ListAllUsers(listWithUsers); var input = SharedController.GetAndValidateInput(); if (input.validatedInput == 0 || input.validatedInput > listWithUsers.Count) { SharedError.PrintWrongMenuInput(); } else { EditUser(admin, listWithUsers[input.validatedInput - 1]); continueLoop = false; } } while (continueLoop); }