Esempio n. 1
0
        public CityListModel GetAllCitiesByState(CityListModel city)
        {
            CityListModel cityListModel = new CityListModel();

            try
            {
                cityListModel.TableCity = null;
                var CityList = this.context?.TableCity.Where(x => x.StateId == city.StateId).ToList();
                if (CityList.Count > 0)
                {
                    cityListModel.TableCity = CityList;
                }
                cityListModel._tenantName = city._tenantName;
                cityListModel._token      = city._token;
                cityListModel._failure    = false;
            }
            catch (Exception es)
            {
                cityListModel._message    = es.Message;
                cityListModel._failure    = true;
                cityListModel._tenantName = city._tenantName;
                cityListModel._token      = city._token;
            }
            return(cityListModel);
        }
Esempio n. 2
0
        public List <CityListModel> GetCityList()
        {
            string sql = "SELECT a.Name, a.NoOfDwellers, b.Name AS CountryDropDown FROM Cities a LEFT JOIN Countries b ON a.CountryID = b.Id ORDER BY a.Name ASC";

            List <CityListModel> cityList   = new List <CityListModel>();
            SqlConnection        connection = new SqlConnection(connectionString);

            connection.Open();
            SqlCommand command = new SqlCommand(sql, connection);

            SqlDataReader reader = command.ExecuteReader();

            int sl = 1;

            while (reader.Read())
            {
                CityListModel aCityList = new CityListModel();
                aCityList.Sl           = sl++;
                aCityList.Name         = reader["Name"].ToString();
                aCityList.NoOfDwellers = Convert.ToInt32(reader["NoOfDwellers"].ToString());
                aCityList.Country      = reader["CountryDropDown"].ToString();
                cityList.Add(aCityList);
            }
            connection.Close();

            return(cityList);
        }
Esempio n. 3
0
        public ActionResult <CityListModel> GetAllCitiesByState(CityListModel city)
        {
            CityListModel cityListModel = new CityListModel();

            try
            {
                cityListModel = _commonService.GetAllCitiesByState(city);
            }
            catch (Exception es)
            {
                cityListModel._failure = true;
                cityListModel._message = es.Message;
            }
            return(cityListModel);
        }
Esempio n. 4
0
        public CityListModel GetAllCitiesByState(CityListModel city)
        {
            CityListModel cityListModel = new CityListModel();
            if (TokenManager.CheckToken(city._tenantName, city._token))
            {
                cityListModel = this.commonRepository.GetAllCitiesByState(city);
                return cityListModel;
            }
            else
            {
                cityListModel._failure = true;
                cityListModel._message = TOKENINVALID;
                return cityListModel;
            }

        }
Esempio n. 5
0
 public Task SaveAsync(CityListModel model)
 {
     throw new NotImplementedException();
 }