Exemple #1
0
        public async override Task TestFindAllAsync()
        {
            using (var transaction = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
            {
                Community community = new Community
                {
                    DistrictId  = 2,
                    CommunityId = 3,
                    Name        = "TestCommunity2"
                };

                Community community2 = new Community
                {
                    DistrictId  = 2,
                    CommunityId = 4,
                    Name        = "TestCommunity3"
                };
                await communityDao.InsertAsync(community);

                await communityDao.InsertAsync(community2);

                IEnumerable <Community> communities = await communityDao.FindAllAsync();

                CollectionAssert.Contains(communities.ToList(), community);
                CollectionAssert.Contains(communities.ToList(), community2);
            }
        }
 public async Task <IEnumerable <Community> > GetAllCommunities()
 {
     try {
         ICommunityDao stationDao = GetICommunityDao();
         return(await stationDao.FindAllAsync());
     }
     catch (Exception) {
         return(null);
     }
 }
 public async Task <IEnumerable <Community> > GetAllCommunities()
 {
     try
     {
         return(await communityDao.FindAllAsync());
     }
     catch (Common.Dal.Ado.MySqlException ex)
     {
         throw new BusinessSqlException(ex.Message, ex.InnerException);
     }
 }
        public async Task <IHttpActionResult> GetCommunities()
        {
            ICommunityDao dao = AdoFactory.Instance.GetCommunityDao("wetr");

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