コード例 #1
0
        //
        // GET: /Channel/
        public ActionResult Index()
        {
            var service = new ReadModelService.SimpleTwitterReadModelServiceClient();
            var query = service.GetChannels();

            return View(query);
        }
コード例 #2
0
        //
        // GET: /Channel/

        public ActionResult Index()
        {
            var service = new ReadModelService.SimpleTwitterReadModelServiceClient();
            var query   = service.GetChannels();

            return(View(query));
        }
コード例 #3
0
        public ActionResult Add()
        {
            ViewBag.Channels = new List<SelectListItem>();

            var service = new ReadModelService.SimpleTwitterReadModelServiceClient();
            foreach (var channel in service.GetChannels())
            {
                ViewBag.Channels.Add(new SelectListItem()
                {
                    Text = channel.Name,
                    Value = channel.Id.ToString()
                });
            }

            return View();
        }
コード例 #4
0
        public ActionResult Add()
        {
            ViewBag.Channels = new List <SelectListItem>();

            var service = new ReadModelService.SimpleTwitterReadModelServiceClient();

            foreach (var channel in service.GetChannels())
            {
                ViewBag.Channels.Add(new SelectListItem()
                {
                    Text  = channel.Name,
                    Value = channel.Id.ToString()
                });
            }

            return(View());
        }
コード例 #5
0
        //
        // GET: /Tweet/
        public ActionResult Index(string channelname="")
        {
            var service = new ReadModelService.SimpleTwitterReadModelServiceClient();
            var query = service.GetTweets();

            var channels = service.GetChannels().Select(channel => new SelectListItem()
                                                                       {
                                                                           Text = channel.Name,
                                                                           Value = channel.Id.ToString()
                                                                       }).ToList();

            ViewBag.Channels = channels;

            ViewBag.GetChannelName = new Func<string, string>(n =>
            {
                var channel = channels.SingleOrDefault(m => m.Value == n);
                if (channel == null || channel.Value == Guid.Empty.ToString())
                {
                    return "Default";
                }

                return channel.Text;
            });

            ViewBag.GetChannelIdByName = new Func<string, Guid>(n =>
            {
                var channel = channels.SingleOrDefault(m => m.Text == n);
                if (channel == null || channel.Value == Guid.Empty.ToString())
                {
                    return Guid.Empty;
                }

                return Guid.Parse(channel.Value);
            });

             if (!string.IsNullOrEmpty(channelname))
            {
                query = query.Where(n => n.Channel == ViewBag.GetChannelIdByName(channelname)).ToArray();
            }

            return View(query);
        }
コード例 #6
0
        //
        // GET: /Tweet/

        public ActionResult Index(string channelname = "")
        {
            var service = new ReadModelService.SimpleTwitterReadModelServiceClient();
            var query   = service.GetTweets();

            var channels = service.GetChannels().Select(channel => new SelectListItem()
            {
                Text  = channel.Name,
                Value = channel.Id.ToString()
            }).ToList();

            ViewBag.Channels = channels;

            ViewBag.GetChannelName = new Func <string, string>(n =>
            {
                var channel = channels.SingleOrDefault(m => m.Value == n);
                if (channel == null || channel.Value == Guid.Empty.ToString())
                {
                    return("Default");
                }

                return(channel.Text);
            });

            ViewBag.GetChannelIdByName = new Func <string, Guid>(n =>
            {
                var channel = channels.SingleOrDefault(m => m.Text == n);
                if (channel == null || channel.Value == Guid.Empty.ToString())
                {
                    return(Guid.Empty);
                }

                return(Guid.Parse(channel.Value));
            });

            if (!string.IsNullOrEmpty(channelname))
            {
                query = query.Where(n => n.Channel == ViewBag.GetChannelIdByName(channelname)).ToArray();
            }

            return(View(query));
        }