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 })); }