示例#1
0
        private Task <TalkSummary[]> GetOtherTalksBySpeaker(string id)
        {
            var talk  = Talks.FirstOrDefault(t => t.Id == id);
            var talks = Talks.Where(t => t.Id != id && t.Speaker == talk.Speaker)
                        .Take(10).Select(MapTalkToSummary).ToArray();

            return(Task.FromResult(talks));
        }
示例#2
0
        public Task <TalkSummary[]> GetTalksByTag(string tag, int show)
        {
            var actualPage = Math.Max(0, show - 1);
            var talks      = Talks.Where(t => t.Tags.Contains(tag))
                             .Skip(actualPage * Constants.PageSize).Take(Constants.PageSize)
                             .Select(MapTalkToSummary).ToArray();

            return(Task.FromResult(talks));
        }
示例#3
0
        public Task <TalkSummary[]> GetTalksBySpeaker(string speaker, int show)
        {
            var actualPage = Math.Max(0, show - 1);
            var talks      = Talks.Where(t => t.Speaker == speaker)
                             .Skip(actualPage * Constants.PageSize).Take(Constants.PageSize)
                             .Select(MapTalkToSummary).ToArray();

            return(Task.FromResult(talks));
        }
示例#4
0
        public Task <TalkSummary[]> SearchTalks(string search, int page)
        {
            var actualPage       = Math.Max(0, page - 1);
            var normalizedSearch = search.ToLowerInvariant();
            var talks            = Talks.Where(t =>
                                               t.Headline.ToLowerInvariant().Contains(normalizedSearch) ||
                                               t.Description.ToLowerInvariant().Contains(normalizedSearch));

            return(Task.FromResult(talks.Skip(actualPage * Constants.PageSize).Take(Constants.PageSize)
                                   .Select(MapTalkToSummary).ToArray()));
        }
 public int GetExactTalksCount()
 {
     return(Talks.Where(x => x.State == TalkState.Message).Count());
 }
示例#6
0
 public Task <bool> DeleteTalk(string id)
 {
     Talks = Talks.Where(t => t.Id != id);
     return(Task.FromResult(true));
 }