Example #1
0
        public async Task <bool> SendUserRatingAsync(int idForRestApi, int rating)
        {
            var url    = RequestPath + idForRestApi + "?Rating=" + rating;
            var result = await contentApiClient.PostRequestBody(url, string.Empty, Settings.AccessToken);

            return(result.StatusCode == HttpStatusCode.Created);
        }
Example #2
0
        public async Task <bool> Register(string username, string password, string firstName, string lastName, string email)
        {
            var content = "{" +
                          "\"email\": \"" + email + "\", " +
                          "\"displayName\": \"" + username + "\", " +
                          "\"password\": \"" + password + "\"," +
                          "\"firstName\": \"" + firstName + "\"," +
                          "\"lastName\": \"" + lastName + "\"" +
                          "}";

            var result = await clientApiClient.PostRequestBody(ServerEndpoints.RegisterUrl, content, false);

            if (result.StatusCode == HttpStatusCode.Created)
            {
                return(true);
            }
            else
            {
                var resultContent = await result.Content.ReadAsStringAsync();

                Debug.WriteLine(resultContent);
            }

            return(false);
        }
Example #3
0
        public async Task PostExhibitVisited(ExhibitsVisitedActionDto action)
        {
            const string requestPath         = "/Actions/ExhibitVisited/Many";
            var          json                = JsonConvert.SerializeObject(action);
            var          httpResponseMessage = await contentApiClient.PostRequestBody(requestPath, json);

            var responseString = await httpResponseMessage.Content.ReadAsStringAsync();

            Debug.WriteLine($"Posted {action.EntityIds.Count} visited exhibits to API with response {responseString}");
        }