public ActionResult Index()
        {
            AppDbContext context = new AppDbContext();

            var model = context.Champions.ToList();
            return View(model);
        }
Exemple #2
0
        static void Main(string[] args)
        {
            // Please, run the website project before this project
            // that way, champion and item data will be already on the database
            var context = new AppDbContext();
            var mcontext = new MatchesDBContext();
            bool downloading = false;

            if (downloading)
            {
                string path = @"C:\RiotMatches\Current";
                DataUpload dataParsing = new DataUpload(path, context, mcontext);
                dataParsing.ParseJsonFiles();
                dataParsing.GetDataFromUrl();

                Console.WriteLine("Done.");
            }
            else
            {
                var matches = mcontext.Matches.ToList();

                Console.WriteLine("Proceeding to create the analysis of all the data uploaded.");
                DataAnalysis data = new DataAnalysis(context, mcontext, matches);
                data.CreateRecord();
                data.CreateCalculatedRecord();

                Console.WriteLine("Done. (Maybe, just check for errors(?)");
            }

            Console.ReadKey();
        }
        public DataUpload(string dataurl, AppDbContext context, MatchesDBContext mcontext)
        {
            DataUrl = dataurl;
            fileNames = Directory.GetFiles(DataUrl, "*.json")
                                    .Select(path => Path.GetFileName(path))
                                    .ToList();

            // first string for id, second for region
            IDMatches = new Queue<RegionId>();
            Matches = new List<InitialDataUpload.Models.Match>();
            Context = context;
            MatchesContext = mcontext;

            ServicePointManager.DefaultConnectionLimit = 10000;
        }
 public StatsByItemController(AppDbContext context)
 {
     _context = context;
 }
 public DataAnalysis(AppDbContext context, MatchesDBContext mcontext, List<Match> matches)
 {
     _context = context;
     _matchesContext = mcontext;
     _matches = matches;
 }