Exemple #1
0
        public static LoginResult attemptSignUp(string username, string password)
        {
            var             req = new UserFieldsRequest(new UserModel(0, username, password, 0));
            IDMessageResult res = APIRequest.createUser(req).GetAwaiter().GetResult();

            if (res.Error != null)
            {
                return(new LoginResult(null, "", res.Error));
            }
            return(attemptLogin(username, password));
        }
Exemple #2
0
        public ModelMessageResult <UserModel> handleAdded(UserModel model)
        {
            var request = new UserFieldsRequest(model);

            IDMessageResult result;

            if (request.Type == 0)
            {
                result = APIRequest.createUser(request).GetAwaiter().GetResult();
            }
            else
            {
                result = APIRequest.createAdmin(request).GetAwaiter().GetResult();
            }

            Result <UserModel> get_result = APIRequest.getUserById(result.Id).GetAwaiter().GetResult();

            return(new ModelMessageResult <UserModel>(result.Error, result.Message, get_result.Items.FirstOrDefault()));
        }
Exemple #3
0
        public static async Task <IDMessageResult> createAdmin(UserFieldsRequest model)
        {
            var response = await client.PostAsJsonAsync(USERS + "signup-admin", model);

            return(await response.Content.ReadAsAsync <IDMessageResult>());
        }