Пример #1
0
 public async Task <IEnumerable <Country> > GetAllCountries()
 {
     try
     {
         return(await countryDao.FindAllAsync());
     }
     catch (Common.Dal.Ado.MySqlException ex)
     {
         throw new BusinessSqlException(ex.Message, ex.InnerException);
     }
 }
Пример #2
0
        public async override Task TestFindAllAsync()
        {
            using (var transaction = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
            {
                Country country = new Country
                {
                    CountryId = 4,
                    Name      = "TestCountry"
                };
                Country country2 = new Country
                {
                    CountryId = 5,
                    Name      = "TestCountry"
                };
                await countryDao.InsertAsync(country);

                await countryDao.InsertAsync(country2);

                IEnumerable <Country> countries = await countryDao.FindAllAsync();

                CollectionAssert.Contains(countries.ToList(), country);
                CollectionAssert.Contains(countries.ToList(), country2);
            }
        }
Пример #3
0
        public async Task <IHttpActionResult> GetCountries()
        {
            ICountryDao dao = AdoFactory.Instance.GetCountryDao("wetr");

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