Exemplo n.º 1
0
        public CityStateCountryModel GetStateByCity(int CityId)
        {
            CityStateCountryModel stateCountryModel = new CityStateCountryModel();

            try
            {
                using (GEEDbContext context = new GEEDbContext())
                {
                    var P1 = new SqlParameter("@CityId", CityId);

                    stateCountryModel = context.Database.SqlQuery <CityStateCountryModel>("GetStateCountyByCity @CityId", P1).FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
                string str = ex.ToString();
            }
            return(stateCountryModel);
        }
Exemplo n.º 2
0
        public async Task <CityStateCountryModel> GetStatByCityId(int id)
        {
            var enquiry = new CityStateCountryModel();

            using (var client = Common.GetHttpClient())
            {
                try
                {
                    var Response = await client.GetAsync(AdmissionConstants.ENQUIRY_API_GETSTATEBYCITY + id);

                    if (Response.IsSuccessStatusCode)
                    {
                        return(JsonConvert.DeserializeObject <CityStateCountryModel>(Response.Content.ReadAsStringAsync().Result));
                    }
                    return(null);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }