Exemplo n.º 1
0
            public async Task <List <HealthItem> > Handle(QueryAsync message)
            {
                var items = new Dictionary <string, Func <Task <string> > >()
                {
                    { "test1", this.Test1 },
                    { "test2", this.Test2 },
                    { "test3", this.Test3 },
                };

                var results = new List <HealthItem>();

                if (string.IsNullOrEmpty(message.Key))
                {
                    // execute all health item functions
                    items.Keys.ForEach(async k =>
                                       results.Add(new HealthItem()
                    {
                        Key = k, Value = await items[k].Invoke()
                    }));
                }
                else if (items.ContainsKey(message.Key))
                {
                    // execute the single health item function
                    results.Add(new HealthItem()
                    {
                        Key = message.Key, Value = await items[message.Key].Invoke()
                    });
                }

                return(results);
            }
Exemplo n.º 2
0
 public async Task <IEnumerable <TaskItem> > Handle(QueryAsync message)
 {
     // paging stuff can go here...
     return(await Task.FromResult(this.tasksContext.Tasks.ToList()));
 }