// GET: api/Heroes public async Task <IHttpActionResult> Get() { List <HeroInfo> result = new List <HeroInfo>(); using (HeroDbContext context = new HeroDbContext()) { var heroes = await context.Heroes.Where(h => true).ToListAsync(); foreach (Hero hero in heroes) { await context.Entry(hero).Collection(h => h.PowerDetails).LoadAsync(); result.Add(new HeroInfo(hero)); } } return(Json(result)); }
public void Update(T entity) { _context.Entry(entity).State = EntityState.Modified; Save(); }