Exemplo n.º 1
0
        public ActionResult ShowAll()
        {
            var pageInf = new PageInf()
            {
                Page = 1, PageSize = 10
            };

            var teams = _teamsLogic.GetTeams(null, pageInf, s => s.Name);

            var teamVMs = AutoMapper.Mapper.Map <IEnumerable <TeamVM> >(teams);

            var viewModel = new TeamsPageVM()
            {
                Teams   = teamVMs,
                PageInf = pageInf
            };

            return(View(viewModel));
        }
Exemplo n.º 2
0
        //public static readonly JsonSerializerSettings jsonSerSettings = new JsonSerializerSettings()
        //    {
        //        ContractResolver = new CamelCasePropertyNamesContractResolver()
        //    };

        public ActionResult Index()
        {
            var pageInf = new PageInf()
            {
                Page = 1, PageSize = 10
            };

            var playersFeed    = _playersLogic.GetPlayersFeed(null, pageInf, s => s.Name);
            var availableTeams = _teamsLogic.GetTeams();

            var playerVMs        = AutoMapper.Mapper.Map <IEnumerable <PlayerVM> >(playersFeed.Collection);
            var availableTeamVMs = AutoMapper.Mapper.Map <IEnumerable <TeamVM> >(availableTeams);

            var viewModel = new PlayersPageVM()
            {
                Players            = playerVMs,
                AvailableTeams     = availableTeamVMs,
                PageInf            = pageInf,
                CountOfAllPlayers  = playersFeed.Count,
                PlayerPositionEnum = _playersLogic.GetPlayerPositionDict()
            };

            return(View(viewModel));
        }