I am getting response from API
{
"success": false,
"message": "Whoops..! Some Error Occured !!",
"parameters": ""
}
so I want to check condition on the basis of true or false. If it is true then it should redirect to another page otherwise it will show a message like-- allready register .
public Command PostCommand
{
get
{
return new Command(async () =>
{
var registrationService = new RegistrationServices();
var response= await registrationService.RegisterData(_registrationViewModel);
if (response.success)
{
// await NavigationPage.
}
else
{
}
});
}
}
public async Task<CustomResponse> PostData(RegistrationViewModel t)
{
try
{
using (HttpClient client = new HttpClient())
{
var json = JsonConvert.SerializeObject(t);
HttpContent content = new StringContent(json);
content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
client.DefaultRequestHeaders.Add("A", "true");
var result = await client.PostAsync("http://xxx.xxx.x.xxx/smaxxxxxi/api/Uxxxxls/Usxxxxxn", content);
return JsonConvert.DeserializeObject<CustomResponse<string>>(result.Content.ReadAsStringAsync().Result);
}
//return false;
}