Ejemplo n.º 1
0
        public async override Task TestFindAllAsync()
        {
            using (var transaction = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
            {
                District district = new District
                {
                    DistrictId = 10,
                    ProvinceId = 4,
                    Name       = "TestDistrict"
                };

                District district2 = new District
                {
                    DistrictId = 11,
                    ProvinceId = 4,
                    Name       = "TestDistrict"
                };
                await districtDao.InsertAsync(district);

                await districtDao.InsertAsync(district2);

                IEnumerable <District> districts = await districtDao.FindAllAsync();

                CollectionAssert.Contains(districts.ToList(), district);
                CollectionAssert.Contains(districts.ToList(), district2);
            }
        }
Ejemplo n.º 2
0
 public async Task <IEnumerable <District> > GetAllDistricts()
 {
     try {
         IDistrictDao stationDao = GetIDistrictDao();
         return(await stationDao.FindAllAsync());
     }
     catch (Exception) {
         return(null);
     }
 }
Ejemplo n.º 3
0
 public async Task <IEnumerable <District> > GetAllDistricts()
 {
     try
     {
         return(await districtDao.FindAllAsync());
     }
     catch (Common.Dal.Ado.MySqlException ex)
     {
         throw new BusinessSqlException(ex.Message, ex.InnerException);
     }
 }
Ejemplo n.º 4
0
        public async Task <IHttpActionResult> GetDistricts()
        {
            IDistrictDao dao = AdoFactory.Instance.GetDistrictDao("wetr");

            return(Ok(await dao.FindAllAsync()));
        }