private async void SaveButtonHouseDetails_Clicked(object sender, EventArgs e) { IfConnected(async() => { UserDetailsHouseModel userDetailshouseModel = new UserDetailsHouseModel(); userDetailshouseModel.House = new UserDetailsHouse() { NotifyTenant = notifyTenent.IsToggled, NumberOfAdults = adultNo.Text != "" ? Convert.ToInt32(adultNo.Text) : 0, NumberOfChildren = childrenNo.Text != "" ? Convert.ToInt32(childrenNo.Text) : 0, Intercom = intercomNumber.Text != "" ? Convert.ToInt32(intercomNumber.Text) : (int?)null, LocalBodyHouseNumber = localBodyHouseNo.Text, ElectricityConsumerNumber = electricityConsumerNo.Text, SaleDeedNumber = saleDeedNo.Text, VehicleNumber = vehicleNo.Text, VehicleMake = vehicleMake.Text, Comments = comments.Text, Resident = Status.Items[Status.SelectedIndex] }; var service = DependencyService.Get <IUserOverview>(); var result = await service.EditUserHouseDetails(id, userDetailshouseModel); if (result) { MessageHelper.ShowToast(ToastNotificationType.Success, MessageHelper.UpdatedSucess); Navigation.PushAsync(new UserDetails(id)); } else { MessageHelper.ShowToast(ToastNotificationType.Error, "Failure"); } }); }
public async Task <bool> EditUserHouseDetails(int id, UserDetailsHouseModel userhousedetails) { var url = string.Format(UrlHelper.EditHouse, id); var result = await PutAsync <UserDetailsHouse>(url, userhousedetails.House); if (result == "{\"success\":true}") { return(true); } else { return(false); } }