// // GET: /DraftPick/ public JsonResult Index(int?fantasyTeamId) { var leagueYear = LeagueYearRepo.GetById(1); var draftPicks = DraftPickRepo.GetDraftPicksByLeagueYear(leagueYear); var model = DraftPickkMapper.MapToSource(draftPicks); if (fantasyTeamId.HasValue) { return(Json(model.Where(x => x.FantasyTeamId == fantasyTeamId.Value).ToList(), JsonRequestBehavior.AllowGet)); } return(Json(model, JsonRequestBehavior.AllowGet)); }
// // GET: /ByeWeek/ public JsonResult Index() { var leagueYear = LeagueYearRepo.GetById(1); var byeWeeks = TeamByeWeekRepo.GetByLeagueYear(leagueYear); var model = ByeWeekMapper.MapToSource(byeWeeks).OrderBy(x => x.WeekNumber); var result2 = model.GroupBy(x => x.WeekNumber) .Select(group => new { WeekNumber = group.Key, Teams = model.Where(c => c.WeekNumber == group.Key) .Select(c => new { TeamId = c.TeamId, TeamName = c.TeamName, TeamCode = c.TeamCode }).OrderBy(x => x.TeamName).ToList() }).ToList(); return(Json(result2, JsonRequestBehavior.AllowGet)); }