示例#1
0
        public ActionResult TypeChart()
        {
            TypeChartViewModel typeChart = new TypeChartViewModel();

            //get all TypeMatchups
            TypeRepository allTypes = new TypeRepository(TypeRepository.GetAllTypes());

            typeChart.TypeMatchups = new Dictionary <String, Dictionary <String, Double> >();

            foreach (var matchup in allTypes.GetTypeMatchups())
            {
                //add key if doesn't exist
                if (!typeChart.TypeMatchups.ContainsKey(matchup.AttackingType))
                {
                    typeChart.TypeMatchups.Add(matchup.AttackingType, new Dictionary <String, Double>());
                }

                //add matchup
                typeChart.TypeMatchups[matchup.AttackingType].Add(matchup.DefendingType, matchup.Modifier);
            }

            //Get all types as String
            typeChart.allTypes = new List <string>();
            foreach (Models.PKM.Type type in TypeRepository.GetAllTypes())
            {
                typeChart.allTypes.Add(type.Name);
            }

            ViewBag.TypeChart = typeChart;

            return(View("TypeChart"));
        }
示例#2
0
        public IActionResult TypeChart()
        {
            TypeChartViewModel model = new TypeChartViewModel()
            {
                TypeChart = this.dataService.GetTypeCharts(),
                Types     = this.dataService.GetObjects <DataAccess.Models.Type>("Name"),
            };

            return(this.View(model));
        }