public async Task <bool> SendEmailAsync(string token, string subject, string body)
        {
            var model = new MessageDetail()
            {
                Body    = body,
                Subject = subject
            };
            var myContent   = JsonConvert.SerializeObject(model);
            var buffer      = System.Text.Encoding.UTF8.GetBytes(myContent);
            var byteContent = new ByteArrayContent(buffer);

            byteContent.Headers.ContentType = new MediaTypeHeaderValue(HttpConstants.MEDIA_TYPE_APPLICATION_FORM);
            byteContent.Headers.Add(App.Configuration.AppConfig.TokenHeaderName, token);
            var requestUri = ClientService.GetRequestUri(ControllerName, "send");
            var response   = await ClientService.PostAsync(requestUri, byteContent);

            if (response != null)
            {
                Task <string> jsonTask = response.Content.ReadAsStringAsync();
                var           result   = JsonConvert.DeserializeObject(jsonTask.Result);
                if (jsonTask.Result.Contains(HttpConstants.SUCCESS))
                {
                    return(true);
                }
            }

            return(false);
        }
        public async Task <bool> AuthenticationAsync(string username, string password)
        {
            if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
            {
                return(false);
            }

            // prompts the user for authentication
            _authenticationResult = await Authenticate(
                ClientService.GetRequestUri(App.Configuration.AppConfig.AuthenticationUrl),
                App.Configuration.GetApplication(), username, password);

            if (_authenticationResult != null)
            {
                App.CurrentUser = _authenticationResult;
                return(true);
            }

            return(false);
        }
Example #3
0
 public async Task <string> WeightLoseWarningPercentile() => await ClientService.GetStringAsync(new Uri(ClientService.GetRequestUri("constants", "weightlosewarningpercentile")));
Example #4
0
 public async Task <string> MoreWebLinks() => await ClientService.GetStringAsync(new Uri(ClientService.GetRequestUri("constants",
                                                                                                                     $"more_links_path" +
                                                                                                                     $"?{App.Configuration?.AppConfig.ApplicationRequestHeader}={App.Configuration?.GetApplication()}" +
                                                                                                                     $"&{HttpConstants.REQUEST_HEADER_LANGUAGE}={App.Configuration?.AppConfig.DefaultLanguage}" +
                                                                                                                     $"&{HttpConstants.VERSION}={App.Configuration?.AppConfig.ApplicationVersion}" +
                                                                                                                     $"&{HttpConstants.PLATFORM}={DeviceInfo.GetPlatform}")));
Example #5
0
 public async Task <string> Blogs() =>
 await ClientService.GetStringAsync(new Uri(ClientService.GetRequestUri("constants",
                                                                        $"blogs?region={App.Configuration.GetApplication()}&lang={App.Configuration?.AppConfig.DefaultLanguage}")));