Beispiel #1
0
        public HttpResponseMessage GetAllReports()
        {
            List <Report>       reports  = ReportsRepository.GetAllReports();
            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, reports);

            return(response);
        }
        public ActionResult Index()
        {
            ReportsRepository ReportRep = new ReportsRepository();
            var myreport = ReportRep.GetAllReports().OrderByDescending(k => k.Match.Fixture.TimeStamp).FirstOrDefault();


            return(View(myreport));
        }
        public ActionResult All()
        {
            ReportsRepository reportrep = new ReportsRepository();
            var myreports = reportrep.GetAllReports();

            if (myreports.Count() > 0)
            {
                ViewData["MyReports"] = myreports.OrderByDescending(k => k.Match.Fixture.TimeStamp).ThenByDescending(k => k.Id);
            }
            return(View());
        }
        public ActionResult View(int Id)
        {
            TeamsRepository TeamsRep = new TeamsRepository();
            var             allteams = TeamsRep.GetAllTeams().Where(t => t.Id != Id).OrderBy(t => t.Name);


            if (allteams.Count() > 0)
            {
                ViewData["AllTeams"] = allteams;
            }

            var myteam = TeamsRep.GetAllTeams().Where(t => t.Id == Id).FirstOrDefault();

            if (myteam != null)
            {
                PlayersRepository playerrep = new PlayersRepository();
                ReportsRepository ReportRep = new ReportsRepository();
                var allreports = ReportRep.GetAllReports().Where(r => r.Match.Fixture.HomeTeamId == Id || r.Match.Fixture.AwayTeamId == Id).OrderByDescending(r => r.Match.Fixture.TimeStamp);



                if (Request.QueryString["opponent"] != null)
                {
                    var opponent = allteams.Where(t => t.Id.ToString() == Request.QueryString["opponent"].ToString()).FirstOrDefault();
                    if (opponent != null)
                    {
                        ViewData["OpponentTeamName"] = opponent.Name;
                        allreports = allreports.Where(k => k.Match.Fixture.HomeTeamId == opponent.Id || k.Match.Fixture.AwayTeamId == opponent.Id).OrderByDescending(k => k.Match.Fixture.TimeStamp);
                        ///return
                    }
                }

                var allhomegames = allreports.Where(h => h.Match.Fixture.HomeTeamId == Id);
                var allawaygames = allreports.Where(h => h.Match.Fixture.AwayTeamId == Id);

                if (allhomegames.Count() > 0)
                {
                    ViewData["HomeGames"] = allhomegames;
                }

                if (allawaygames.Count() > 0)
                {
                    ViewData["AwayGames"] = allawaygames;
                }
                return(View(myteam));
            }
            else
            {
                return(Redirect("/"));
            }
        }
        public ActionResult View(int Id)
        {
            ReportsRepository ReportRep = new ReportsRepository();
            var myreport = ReportRep.GetAllReports().Where(r => r.Id == Id).FirstOrDefault();

            if (myreport != null)
            {
                return(View(myreport));
            }
            else
            {
                return(Redirect("/"));
            }
        }