예제 #1
0
        public ActionResult DisplayTeams()
        {
            var viewModel = new TeamsVM();

            viewModel.TeamList = _league.GetAllTeams().ResponseType;
            return(View(viewModel));
        }
예제 #2
0
        public ActionResult GetAllTeams()
        {
            TeamsVM teams = new TeamsVM();

            teams.TeamList = _league.GetAllTeams().ResponseType;
            return(View(teams));
        }
예제 #3
0
        public ActionResult CreateTeam()
        {
            TeamsVM team = new TeamsVM();

            team.Clients = Mapper.Map <List <ClientsVM> >(ClientsDAL.ReadClients());
            return(View(team));
        }
예제 #4
0
        public ActionResult EditTeam(string currentTeamName)
        {
            var viewModel = new TeamsVM();

            viewModel.Team = _league.GetAllTeams().ResponseType.FirstOrDefault(t => t.Name == currentTeamName);
            viewModel.SetPlayers(_league.GetAllPlayersForTeam(viewModel.Team.Name).ResponseType);
            return(View(viewModel));
        }
예제 #5
0
        public ActionResult DeleteTeam(Team team)
        {
            _league.DeleteATeam(team);
            var viewModel = new TeamsVM();

            viewModel.TeamList = _league.GetAllTeams().ResponseType;
            return(RedirectToAction("GetAllTeams"));
        }
예제 #6
0
        public ActionResult GetAllTeams(string currentTeamName)
        {
            var viewModel = new TeamsVM();
            var teamList  = _league.GetAllPlayersForTeam(currentTeamName).ResponseType;

            viewModel.TeamList   = _league.GetAllTeams().ResponseType;
            viewModel.PlayerList = teamList;
            return(View(viewModel));
        }
예제 #7
0
 public ActionResult EditTeam(TeamsVM viewModel)
 {
     if (ModelState.IsValid)
     {
         _league.EditTeam(viewModel.Team);
         return(RedirectToAction("GetAllTeams"));
     }
     viewModel.SetPlayers(_league.GetAllPlayersForTeam(viewModel.Team.Name).ResponseType);
     return(View(viewModel));
 }
예제 #8
0
        // GET: Team/Details/5
        public ActionResult Details(int id)
        {
            Team    t   = MyTeamService.GetById(id);
            TeamsVM TVM = new TeamsVM()
            {
                name = t.name
            };

            return(View(TVM));
        }
예제 #9
0
        // GET: Team/Edit/5
        public ActionResult Edit(int id)
        {
            Team    t  = MyTeamService.GetById(id);
            TeamsVM tm = new TeamsVM();


            tm.name = t.name;
            // ImageUrl = Image.FileName

            return(View(tm));
        }
예제 #10
0
        public ActionResult Create(TeamsVM TeamsVM, HttpPostedFileBase image)
        {
            Team TeamDomain = new Team()
            {
                image = image.FileName,
                name  = TeamsVM.name,
            };

            MyTeamService.Add(TeamDomain);
            MyTeamService.Commit();
            //ajout de l'image dans un dossier Upload
            var path = Path.Combine(Server.MapPath("~/Content/Upload/"), image.FileName);

            image.SaveAs(path);
            return(RedirectToAction("Index"));
        }
예제 #11
0
        public ActionResult Edit(int id, TeamsVM tm)
        {
            try
            {
                Team t = MyTeamService.GetById(id);
                t.name = tm.name;

                MyTeamService.Update(t);
                MyTeamService.Commit();
                // TODO: Add update logic here
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                return(View(tm));
            }
        }
예제 #12
0
 public ActionResult DeleteTeam(TeamsVM team)
 {
     TeamsDAL.DeleteTeam(Mapper.Map <TeamsDM>(team));
     return(View());
 }