예제 #1
0
        public ActionResult Details(int id = 0, int?p = 1)
        {
            Jockey jockey = db.Jockeys.Find(id);

            if (jockey == null)
            {
                return(HttpNotFound());
            }
            if (jockey.TwitterId != null)
            {
                var auth   = TwitterUtilities.GetAuthorizer();
                var ctx    = new TwitterContext(auth);
                var tweets =
                    from tweet in ctx.Status
                    where tweet.Type == StatusType.User &&
                    tweet.ScreenName == jockey.TwitterId
                    select tweet;

                if (tweets != null)
                {
                    try
                    {
                        ViewData["Tweets"] = tweets.ToList();
                    }
                    catch
                    {
                        Console.WriteLine("Tweet problem...");
                    }
                }
            }
            int page = p ?? 1;

            ViewBag.Results = db.Results.Include("Race.Meeting.Course").Include("Horse").Where(r => r.Jockey.Id == jockey.Id).OrderByDescending(r => r.Race.OffTime).ToPagedList(page, 50);
            return(View(jockey));
        }
예제 #2
0
        public ActionResult Details(int id = 0, int?p = 1)
        {
            Course course = db.Courses.Include(t => t.Address).FirstOrDefault(t => t.Id == id);

            if (course == null)
            {
                return(HttpNotFound());
            }
            if (course.TwitterId != null)
            {
                var auth   = TwitterUtilities.GetAuthorizer();
                var ctx    = new TwitterContext(auth);
                var tweets =
                    from tweet in ctx.Status
                    where tweet.Type == StatusType.User &&
                    tweet.ScreenName == course.TwitterId
                    select tweet;

                if (tweets != null)
                {
                    ViewBag.Tweets = tweets.ToList();
                }
            }

            int page = p ?? 1;

            ViewBag.Races = db.Races.Where(r => r.Meeting.Course.Id == course.Id).OrderByDescending(r => r.OffTime).ToPagedList(page, 50);


            return(View(course));
        }
예제 #3
0
        public ActionResult Details(int id = 0)
        {
            Trainer trainer = db.Trainers.Include(t => t.Address).FirstOrDefault(t => t.Id == id);

            if (trainer == null)
            {
                return(HttpNotFound());
            }
            if (trainer.TwitterId != null)
            {
                var auth   = TwitterUtilities.GetAuthorizer();
                var ctx    = new TwitterContext(auth);
                var tweets =
                    from tweet in ctx.Status
                    where tweet.Type == StatusType.User &&
                    tweet.ScreenName == trainer.TwitterId
                    select tweet;

                if (tweets != null)
                {
                    ViewData["Tweets"] = tweets.ToList();
                }
            }
            return(View(trainer));
        }