public async Task <JsonResult> GetHeroes() { var apiRepo = new Dota2Results(); var results = await apiRepo.GetHores(); return(Json(results, JsonRequestBehavior.AllowGet)); }
public static void ImportHeroes() { var apiRepo = new Dota2Results(); var heroesResult = apiRepo.GetHores().Result; using (var ctx = new ApplicationContext()) { foreach (var hero in heroesResult.Heroes) { var herEntity = new WebApiRepository.Models.Heroes { Id = hero.Id, Name = hero.Name, ValveHeroName = hero.ValveName }; Console.WriteLine("Saving -> {0}", hero.Name); ctx.Heroes.Add(herEntity); } ctx.SaveChanges(); } }