public IActionResult CreateUser(NewUserModel newUserModel, DataServices dataServices)
        {
            var adminKey = LocalConfigurationServices.GetAdminKey();

            if (!newUserModel.AdminKey.Equals(adminKey))
            {
                return(View());
            }
            var salt        = PasswordServices.SaltGen();
            var newUser     = new UserDataModel(newUserModel.Username, newUserModel.Name, PasswordServices.HashGen(salt, newUserModel.Password), salt);
            var newUserList = new List <UserDataModel>();

            newUserList.Add(newUser);
            dataServices.SaveUserData(newUserList, false);
            return(RedirectToAction(actionName: "Index", controllerName: "Admin"));
        }
        public IActionResult DeleteUser(DeleteUserRequest deleteUserRequest, DataServices dataServices)
        {
            var user = dataServices.GetUserData().Where(u => u.Username.Equals(deleteUserRequest.Username));

            if (user.Count() == 0)
            {
                return(View());
            }
            var adminKey = LocalConfigurationServices.GetAdminKey();

            if (deleteUserRequest.AdminKey != adminKey)
            {
                return(View());
            }
            var users     = dataServices.GetUserData().Where(u => !u.Username.Equals(deleteUserRequest.Username));
            var usersList = users.ToList();

            dataServices.SaveUserData(usersList, true);
            return(RedirectToAction(actionName: "Index", controllerName: "Admin"));
        }