Пример #1
0
        internal static string LoginUser(string username, string authenticationCode)
        {
            ValidateUsername(username);
            ValidateAuthCode(authenticationCode);

            var userModel = new UserLoginModel()
            {
                Username = username,
                AuthCode = authenticationCode
            };
            var loginResponse = HttpRequester.Post <LoginResponseModel>(BaseServicesUrl + "auth/token",
                                                                        userModel);

            AccessToken = loginResponse.AccessToken;
            return(loginResponse.DisplayName);
        }
Пример #2
0
        internal static void RegisterUser(string username, string displayName, string email,
                                          string phone, string location, string authenticationCode)
        {
            ValidateUsername(username);
            ValidateEmail(email);
            ValidateAuthCode(authenticationCode);

            var userModel = new UserModel()
            {
                Username    = username,
                DisplayName = displayName,
                Email       = email,
                Phone       = phone,
                Location    = location,
                AuthCode    = authenticationCode
            };

            HttpRequester.Post(BaseServicesUrl + "users/register",
                               userModel);
        }
Пример #3
0
        internal static void CreateNewTodosList(string title, string description, DateTime deadline, double price,
                                                string category, string totalDifficulty, IEnumerable <TaskViewModel> tasks)
        {
            var listModel = new JobDetailedModel()
            {
                Title           = title,
                Description     = description,
                Deadline        = deadline,
                Price           = price,
                Category        = category,
                TotalDifficulty = totalDifficulty.ToString(),
                Tasks           = tasks.Select(t => new TaskModel()
                {
                    Name       = t.Name,
                    Difficulty = t.Difficulty
                }).ToList()
            };

            var headers = new Dictionary <string, string>();

            headers["X-accessToken"] = AccessToken;

            HttpRequester.Post <JobViewModel>(BaseServicesUrl + "jobs/new", listModel, headers);
        }