public MemberCredential Login(Memberlogin memberlogin)
        {
            var httpClient       = new HttpClient();
            var dataToSend       = JsonConvert.SerializeObject(memberlogin);
            var content          = new StringContent(dataToSend, Encoding.UTF8, "application/json");
            var response         = httpClient.PostAsync(ProjectConfiguration.MEMBER_LOGIN_URL, content).GetAwaiter().GetResult();
            var memberCredential = JsonConvert.DeserializeObject <MemberCredential>(response.Content.ReadAsStringAsync().Result);

            return(memberCredential);
        }
Esempio n. 2
0
        private void ButtonLogin_OnClick(object sender, RoutedEventArgs e)
        {
            var memberlogin = new Memberlogin
            {
                email    = Email.Text,
                password = Password.Password
            };
            var memberCredential = this._memberService.Login(memberlogin);

            this._fileService.SaveMemberCredentialToFile(memberCredential);
        }