private async void Button_Clicked(object sender, EventArgs e) { if (model.FirstName == null || model.FirstName == "" || model.LastName == null || model.LastName == "" || model.Email == null || model.Email == "" || model.Phone == null || model.Phone == "" || model.Username == null || model.Username == "") { await Application.Current.MainPage.DisplayAlert("Error", "All fields are required!", "OK"); return; } Model.User user = await _apiService.GetById <Model.User>(BaseAPIService.Id); if (user != null) { UserUpsertRequest request = new UserUpsertRequest() { FirstName = model.FirstName, LastName = model.LastName, Email = model.Email, Username = model.Username, Phone = model.Phone, RoleId = user.RoleId, Image = user.Image }; Model.User updatedUser = await _apiService.Update <Model.User>(user.Id, request); if (updatedUser != null) { await Application.Current.MainPage.DisplayAlert("Success", "Successfuly updated data! Now, just log in.", "OK"); await Navigation.PushAsync(new LoginPage()); } } }
public async Task Initialization() { _client = await _userApiService.GetById <User>(BaseAPIService.Id); _hairdresser = await _hairdresserApiService.GetById <Hairdresser>(_hairdresser.Id); FirstName = _hairdresser.FirstName; LastName = _hairdresser.LastName; Email = _hairdresser.Email; Phone = _hairdresser.Phone; Image = _hairdresser.Image; List <Hairstyle> hairstyles = await _hairdresserHairstyleApiService.FindAllHairstylesOfHairdresser(_hairdresser.Id); _hairstyleList.Clear(); foreach (var hairstyle in hairstyles) { _hairstyleList.Add(hairstyle); } RecommendedHairdresserSearchRequest request = new RecommendedHairdresserSearchRequest { HairdresserId = _hairdresser.Id }; List <Hairdresser> recommendedList = await _recommendedApiService.GetAll <List <Hairdresser> >(request); _recommendedHairdressersList.Clear(); foreach (var item in recommendedList) { _recommendedHairdressersList.Add(item); } }
public async Task Init() { Model.User user = await _apiService.GetById <Model.User>(BaseAPIService.Id); if (user != null) { Username = user.Username; FirstName = user.FirstName; LastName = user.LastName; Email = user.Email; Phone = user.Phone; } }