private async void GetProfile() { var proxy = new AccountProxy(); var response = await proxy.GetProfile(); if (response.Succeeded) { Model = response.Response.Value <JToken>("response").ToObject <SellerProfileModel>(); Model.StarUrl = "ic_rating_star"; } else { await pageDialogService.DisplayAlertAsync("Hubo un error", "Se generó un problema, inicie sesión nuevamente.", "Ok"); await navigationService.NavigateAsync("/Login?SignOut"); } }
private async void SignIn() { var proxy = new AccountProxy(); var signInResponse = await proxy.SignIn(model.Email, model.Password); if (signInResponse.Succeeded) { Credentials.Instance.SignIn(signInResponse.Response); var roleResponse = await proxy.GetRole(); var role = (RoleType)roleResponse.Response.Value <int>("role"); var profileResponse = await proxy.GetProfile(); var navParams = new NavigationParameters(); switch (role) { case RoleType.Buyer: var buyerModel = profileResponse.Response.Value <JToken>("response").ToObject <BuyerProfileModel>(); navParams.Add("model", buyerModel); await navigationService.NavigateAsync("/Navigation/BuyerMode/BuyerProfile", navParams); break; case RoleType.Seller: var sellerModel = profileResponse.Response.Value <JToken>("response").ToObject <SellerProfileModel>(); sellerModel.StarUrl = "ic_rating_star"; navParams.Add("model", sellerModel); await navigationService.NavigateAsync("/Navigation/SellerMode/SellerProfile", navParams); break; } } }