public async void GetUsedService() { // lay du lieu tu db myAPI = RestService.For <IMyAPI>("https://goldenspa.azurewebsites.net"); var idCustomer = await myAPI.GetIdCustomer("0123456789"); string cus = idCustomer.Substring(2, idCustomer.Length - 4); var resultService = await myAPI.GetListServiceUsed(cus); var resultCombo = await myAPI.GetListComboUsed(cus); var max = resultService.Count() + resultCombo.Count(); mUsedService = new List <ListPromotion>(max); for (int i = 0; i < resultService.Count; i++) { var DataSample_Services_Outlet_ViewModel = new ListPromotion(); DataSample_Services_Outlet_ViewModel.MaDV = resultService[i].MaDV; DataSample_Services_Outlet_ViewModel.Image = resultService[i].Image; DataSample_Services_Outlet_ViewModel.NameService = resultService[i].NameService; DataSample_Services_Outlet_ViewModel.price = resultService[i].price; DataSample_Services_Outlet_ViewModel.TotalOutlets = resultService[i].TotalOutlets; mUsedService.Add(DataSample_Services_Outlet_ViewModel); } for (int i = resultService.Count; i < max; i++) { var DataSample_Services_Outlet_ViewModel = new ListPromotion(); DataSample_Services_Outlet_ViewModel.MaDV = resultCombo[i - resultService.Count].MaDV; DataSample_Services_Outlet_ViewModel.Image = resultCombo[i - resultService.Count].Image; DataSample_Services_Outlet_ViewModel.NameService = resultCombo[i - resultService.Count].NameService; DataSample_Services_Outlet_ViewModel.price = resultCombo[i - resultService.Count].price; DataSample_Services_Outlet_ViewModel.TotalOutlets = resultCombo[i - resultService.Count].TotalOutlets; mUsedService.Add(DataSample_Services_Outlet_ViewModel); } mAdapterUsedService = new Home_UsedService_Customer_Adapter(mUsedService); mRecyclerViewUsedService.SetAdapter(mAdapterUsedService); mAdapterUsedService.ItemClick += (s, e) => { var intent = new Intent(Activity, typeof(Customer.activity_Service_Customer)); if (e >= 0 && e < resultService.Count) { intent.PutExtra("ServiceId", mUsedService[e].MaDV); } else { intent.PutExtra("ComboId", mUsedService[e].MaDV); } intent.PutExtra("ServiceName", mUsedService[e].NameService); if (mUsedService[e].NamePromotion == null) { intent.PutExtra("PromotionName", mUsedService[e].price.ToString()); } else { intent.PutExtra("PromotionName", mUsedService[e].NamePromotion.ToString()); } intent.PutExtra("Index", e.ToString()); StartActivity(intent); }; }