Example #1
0
 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());
 }
Example #2
0
 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;
 }
Example #3
0
        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 }));
        }