private async Task <bool> ExecuteLoginCommandAsync() { try { ValidateFields(); if (_userName.IsValid && _password.IsValid) { _userDialogs.ShowLoading("Loading", null); LoginRequest loginRequest = new LoginRequest(); loginRequest.Email = UserName.Value; loginRequest.Password = Password.Value; _accountService = new AccountService(); _complaintService.DeleteCity(); var responce = await _accountService.RequestToken(loginRequest); if (responce == true) { var UserInfo = await _accountService.GetUserInfo(); _settings.UserId = UserInfo.UserId; _settings.UserName = UserInfo.UserId; _settings.UserCity = UserInfo.City; _settings.Email = UserInfo.Email; _settings.PhoneNumber = UserInfo.PhoneNumber; _settings.Name = UserInfo.Name; _settings.UserRole = UserInfo.UserRole; _settings.IsLogin = true; await _complaintService.GetCities(""); var CityModel = await _complaintService.GetCityByName(UserInfo.City); if (CityModel == null) { _userDialogs.HideLoading(); await PageDialogService.DisplayAlertAsync(null, "Sorry, for your City this APP is not active right now.", "OK"); _settings.IsLogin2 = false; return(true); } _settings.UserCityId = CityModel.ExternalId; var Lows = await _complaintService.GetAllLows(_settings.UserId, CityModel.ExternalId); _settings.UserCityId = CityModel.ExternalId; _userDialogs.HideLoading(); await NavigationService.NavigateAsync(new System.Uri($"/{AppPages.SSCMaster.SSCMasterPage}/{AppPages.NavigationPage}/{AppPages.DashBoard.HomePage}", System.UriKind.Absolute)); } else { _userDialogs.HideLoading(); await PageDialogService.DisplayAlertAsync("Login", "Invalid login credentials", "OK"); } } return(true); } catch (Exception ex) { _userDialogs.HideLoading(); await PageDialogService.DisplayAlertAsync(null, AppAlertMessage.TechnicalError, "OK"); return(true); } }