public void TestBuildPartitionKey()
        {
            const string city = "city";
            const string date = "2015-05-21";

            Assert.AreEqual(string.Format("{0};{1}", city, date), NewsEntity.BuildPartitionkey(city, DateTime.Parse(date)));
        }
Exemple #2
0
 public async Task DeleteNews(string city, DateTime date, Guid id)
 {
     await this.tableStore.DeleteTableEntity <NewsEntity>(NewsEntity.BuildPartitionkey(city, date), id.ToString());
 }
Exemple #3
0
        public async Task <bool> ContainsAnyHotNews(string city, DateTime date)
        {
            List <NewsEntity> newsList = (await this.tableStore.ListTableEntityByPartitionKey <NewsEntity>(NewsEntity.BuildPartitionkey(city, date))).ToList();

            return(newsList.Any());
        }
Exemple #4
0
 public async Task <IEnumerable <NewsBll> > ListNews(string city, DateTime date)
 {
     return
         ((await this.tableStore.ListTableEntityByPartitionKey <NewsEntity>(NewsEntity.BuildPartitionkey(city, date)))
          .Select(NewsEntity.ToNewsBll));
 }
Exemple #5
0
 public async Task <NewsBll> GetNews(string city, DateTime date, Guid id)
 {
     return(NewsEntity.ToNewsBll(await this.tableStore.GetTableEntity <NewsEntity>(NewsEntity.BuildPartitionkey(city, date), id.ToString())));
 }