Example #1
0
        private async void getServiceAndCombo()
        {
            myAPI = RestService.For <IMyAPI>("https://goldenspa.azurewebsites.net");
            var maCN          = Intent.GetStringExtra("OutletId");
            var resultService = await myAPI.GetServiceFromOutlet(maCN);

            var resultCombo = await myAPI.GetComboFromOutlet(maCN);

            var max = resultService.Count + resultCombo.Count;

            mService_List = new List <ListService>(max);

            for (int i = 0; i < resultService.Count; i++)
            {
                var DataSample_Services_Outlet_ViewModel = new ListService();
                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.Discount    = resultService[i].Discount;
                mService_List.Add(DataSample_Services_Outlet_ViewModel);
            }

            for (int i = resultService.Count; i < max; i++)
            {
                var DataSample_Services_Outlet_ViewModel = new ListService();
                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.Discount    = resultCombo[i - resultService.Count].Discount;
                mService_List.Add(DataSample_Services_Outlet_ViewModel);
            }

            mAdapterService = new Outlet_Service_Customer_Adapter(mService_List);
            mRecyclerViewService.SetAdapter(mAdapterService);
        }