コード例 #1
0
        /// <summary>
        /// get a list of districts using districtService
        /// </summary>
        /// <returns>A list of district in the system</returns>
        public List <District> getDistricts()
        {
            try
            {
                //instantiate a new instance of district service
                IDistrictService districtService = new DistrictService(System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString);
                //get all district in the system using district service
                var districts = districtService.GetAllDistrict().ToList();

                return(districts);
            }
            catch (Exception)
            {
                Response.Redirect("~/Errors/InternalErrors.aspx", false);
                return(null);
            }
        }