Guest User

Untitled

a guest
Oct 20th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Web.Mvc;
  4. using SSV.ViewModels;
  5.  
  6. namespace SSV.Controllers
  7. {
  8. public class MatchesController : BaseController
  9. {
  10. //
  11. // GET: /Spiele/
  12. // Routed: /Matches/
  13.  
  14. public ActionResult Index()
  15. {
  16. MatchesOverview vm = new MatchesOverview()
  17. {
  18. UpcomingFirst = Context.Games.Where(i => i.Date.CompareTo(DateTime.Now) == -1 && i.TeamId == 1).Take(5).ToList(),
  19. UpcomingSecond = Context.Games.Where(i => i.Date.CompareTo(DateTime.Now) == -1 && i.TeamId == 2).Take(5).ToList(),
  20. PastGames = Context.Games.Where(i => i.Date.CompareTo(DateTime.Now) == 1).ToList()
  21. };
  22.  
  23. return View(vm);
  24. }
  25.  
  26.  
  27. //
  28. // GET: /Spiele/SpielDetails/42
  29. // Routed: /Matches/Detail/42
  30.  
  31. public ActionResult Detail(int id)
  32. {
  33. MatchDetail vm = new MatchDetail()
  34. {
  35. Game = Context.Games.Single(i => i.Id == id)
  36. };
  37.  
  38. return View(vm);
  39. }
  40.  
  41. }
  42. }
Add Comment
Please, Sign In to add comment