public NewSeasonController() { this.db = new DreamLeagueContext(); this.gameWeekSerializer = new XMLGameWeekSerializer <GameWeekSummary>(); this.cupWeekSerializer = new XMLGameWeekSerializer <CupWeekSummary>(); this.playerListService = new PlayerListService(db, new XLSXPlayerListReader()); this.teamSheetService = new TeamSheetService(new XLSXTeamSheetReader()); }
public NewSeasonController(IDreamLeagueContext db, IGameWeekSerializer <GameWeekSummary> gameWeekSerializer, IGameWeekSerializer <CupWeekSummary> cupWeekSerializer, IPlayerListService playerListService, ITeamSheetService teamSheetService) { this.db = db; this.gameWeekSerializer = gameWeekSerializer; this.cupWeekSerializer = cupWeekSerializer; this.playerListService = playerListService; this.teamSheetService = teamSheetService; }
public ActionResult Players(HttpPostedFileBase file) { string result = "File format must be .xlsx"; if (Path.GetExtension(file.FileName) == ".xlsx") { result = playerListService.Upload(file); } else if (Path.GetExtension(file.FileName) == ".csv") { playerListService = new PlayerListService(db, new CSVPlayerListReader()); result = playerListService.Upload(file); } if (result == "Success") { return(RedirectToAction("Index", new { message = "Players uploaded." })); } return(RedirectToAction("Index", new { warning = result })); }