public static async Task <List <Card> > GetRandomCards(int count, MtgDbContext context) { var cards = await context.Cards.Where(c => !c.rarity.Equals("Basic Land")).OrderBy(r => Guid.NewGuid()).Include(c => c.rulings).Take(count).ToListAsync(); FillImages(cards); return(cards); }
public async Task <AddDeckPayload> AddDeckAsync( AddDeckInput input, [Service] MtgDbContext context) { var deck = new DeckEntity { Id = Guid.NewGuid(), UserId = input.UserId, Name = input.Name, }; await context.Decks.AddAsync(deck); await context.SaveChangesAsync(); return(new AddDeckPayload(input.ClientMutationId, deck)); }
public async Task <AddUserPayload> AddUserAsync( AddUserInput input, [Service] MtgDbContext context) { var user = new UserEntity { Id = Guid.NewGuid(), Name = input.Name, RolesString = input.Roles, PasswordHash = input.PasswordHash }; await context.Users.AddAsync(user); await context.SaveChangesAsync(); return(new AddUserPayload(input.ClientMutationId, user)); }
public MtgCollectionManager(MtgDbContext mtg_context, UserCollectionDbContext collection_context) { this.mtg_context = mtg_context; this.collection_context = collection_context; }
public IQueryable <StatsEntity> Stats([Service] MtgDbContext context) => context.Stats;
public IQueryable <GameEntity> Games([Service] MtgDbContext context) => context.Games;
public IQueryable <DeckEntity> Decks([Service] MtgDbContext context) => context.Decks;
public IQueryable <UserEntity> Users([Service] MtgDbContext context) => context.Users;
public GameParticipationByUserIdDataLoader(MtgDbContext db) { this.db = db; }
public UserByIdDataLoader(MtgDbContext dbContextPool) { dbContext = dbContextPool ?? throw new ArgumentNullException(nameof(dbContextPool)); }
public StatsByUserIdDataLoader(MtgDbContext dbContextPool) { _dbContextPool = dbContextPool ?? throw new ArgumentNullException(nameof(dbContextPool)); }
public BaseController() { _context = new MtgDbContext(); }
public MtgUpdaterService(HttpClient httpClient, MtgDbContext context) { this.httpClient = httpClient; this.context = context; }
public DeckByUserIdDataLoader(MtgDbContext db) { this.db = db; }