// GET: Home public ActionResult Index() { MatchReportRepository matchreportrep = new MatchReportRepository(); var report = matchreportrep.GetAllReports().OrderByDescending(k => k.Match.Timestamp).FirstOrDefault(); return(View(report)); }
public ActionResult All() { MatchReportRepository matchreportsrep = new MatchReportRepository(); var mymatchreports = matchreportsrep.GetAllReports(); if (mymatchreports.Count() > 0) { ViewData["Reports"] = mymatchreports.OrderByDescending(k => k.Match.Timestamp).ThenByDescending(k => k.Id); } return(View()); }
public ActionResult View(int Id) { TeamsRepository teamsrep = new TeamsRepository(); var allteams = teamsrep.GetAllTeams().Where(k => k.Id != Id).OrderBy(k => k.TeamName); if (allteams.Count() > 0) { ViewData["AllTeams"] = allteams; } var team = teamsrep.GetAllTeams().Where(k => k.Id == Id).FirstOrDefault(); if (team != null) { MatchReportRepository matchreportrep = new MatchReportRepository(); var allreports = matchreportrep.GetAllReports().Where(k => k.Match.HomeTeamId == Id || k.Match.AwayTeamId == Id).OrderByDescending(k => k.Match.Timestamp); if (Request.QueryString["opponent"] != null) { var opponent = allteams.Where(k => k.Id.ToString() == Request.QueryString["opponent"].ToString()).FirstOrDefault(); if (opponent != null) { ViewData["OpponentTeamName"] = opponent.TeamName; allreports = allreports.Where(k => k.Match.HomeTeamId == opponent.Id || k.Match.AwayTeamId == opponent.Id).OrderByDescending(k => k.Match.Timestamp); } } var allhomegames = allreports.Where(k => k.Match.HomeTeamId == Id); var allawaygames = allreports.Where(k => k.Match.AwayTeamId == Id); if (allhomegames.Count() > 0) { ViewData["HomeGames"] = allhomegames; } if (allawaygames.Count() > 0) { ViewData["AwayGames"] = allawaygames; } return(View(team)); } else { return(Redirect("/")); } }
public ActionResult View(int Id) { MatchReportRepository matchreportrep = new MatchReportRepository(); var report = matchreportrep.GetAllReports().Where(k => k.Id == Id).FirstOrDefault(); if (report != null) { return(View(report)); } else { return(Redirect("/")); } }