public IActionResult IndexCity(string provinceID)
        {
            var model     = new IndexCityViewModel();
            int decryptID = Convert.ToInt32(EncryptionHelper.DecryptUrlParam(provinceID));

            var endpoint = url + "/GetIndexCity/" + decryptID;
            var province = Utilities.RestAPIHelper <IndexCityViewModel> .Submit("", Method.GET, endpoint);

            //model.ID = provinceID;
            model.ProvinceID   = provinceID;
            model.CountryName  = province.CountryName;
            model.CountryCode  = province.CountryCode;
            model.ProvinceName = province.ProvinceName;

            return(View(model));
        }
Exemple #2
0
        public IActionResult GetIndexCity(int provinceID)
        {
            var model    = new IndexCityViewModel();
            var province = _provinceProvider.Get(provinceID);
            var country  = _countryProvider.Get(province.CountryId);

            if (province == null)
            {
                return(NotFound("Province not found"));
            }

            model.CountryName  = country.Name;
            model.CountryCode  = country.Code;
            model.ProvinceName = province.Name;
            return(Ok(model));
        }