POS-32 Poprwka

This commit is contained in:
Wojciech Przybyła 2020-12-21 16:26:48 +01:00
parent 2ea2a4293f
commit 10cf3ca9c0

View File

@ -66,7 +66,13 @@ namespace Klient.Droid
if (response.StatusCode == HttpStatusCode.OK) if (response.StatusCode == HttpStatusCode.OK)
{ {
savedLogin = Login; savedLogin = Login;
var jsonString = await response.Content.ReadAsStringAsync();
dynamic jsonObject = JsonConvert.DeserializeObject(jsonString);
SetContentView(Resource.Layout.ekranPoLogowaniu); SetContentView(Resource.Layout.ekranPoLogowaniu);
savedName = jsonObject.user.name;
savedEmail = jsonObject.user.email;
savedSurname = jsonObject.user.surname;
} }
} }
@ -177,12 +183,18 @@ namespace Klient.Droid
var Surname = FindViewById<EditText>(Resource.Id.ChangeSurname).Text; var Surname = FindViewById<EditText>(Resource.Id.ChangeSurname).Text;
var Email = FindViewById<EditText>(Resource.Id.ChangeEmail).Text; var Email = FindViewById<EditText>(Resource.Id.ChangeEmail).Text;
if (string.IsNullOrEmpty(Name) | string.IsNullOrEmpty(Email) | string.IsNullOrEmpty(Surname)) if (string.IsNullOrEmpty(Name))
{ {
FindViewById<TextView>(Resource.Id.NullValueProfile).Text = "Wartości nie mogą być puste!"; Name = savedName;
} }
else if (string.IsNullOrEmpty(Email))
{ {
Email = savedEmail;
}
if (string.IsNullOrEmpty(Surname))
{
Surname = savedSurname
}
var values = new Dictionary<string, string> var values = new Dictionary<string, string>
{ {
{ "email", Email }, { "email", Email },
@ -197,7 +209,7 @@ namespace Klient.Droid
var responseString = await response.Content.ReadAsStringAsync(); var responseString = await response.Content.ReadAsStringAsync();
if (response.StatusCode == HttpStatusCode.OK) FindViewById<TextView>(Resource.Id.NullValueProfile).Text = "Zapisano!"; if (response.StatusCode == HttpStatusCode.OK) FindViewById<TextView>(Resource.Id.NullValueProfile).Text = "Zapisano!";
}
} }
} }
} }