public async Task <IList <Challenge> > GetList() { IList <Challenge> foundChallenges; using (EntityModelContext context = new EntityModelContext(Configuration)) { foundChallenges = await context.Challenge.ToListAsync(); } return(foundChallenges); }
public IList <Writer> List() { List <Writer> allWriters; using (EntityModelContext context = new EntityModelContext(Configuration)) { allWriters = context.Writer.ToList(); } return(allWriters); }
public async Task <Challenge> GetById(int id) { Challenge foundChallenge = null; using (EntityModelContext context = new EntityModelContext(Configuration)) { foundChallenge = await context.Challenge /*.Include(ch => ch.Classification) * .ThenInclude(cl => cl.ShortStory) * .ThenInclude(ss => ss.Writer)*/ .FirstOrDefaultAsync(x => x.Id == id); } return(foundChallenge); }