Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        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;
 }
Exemplo n.º 5
0
 public IQueryable <StatsEntity> Stats([Service] MtgDbContext context) =>
 context.Stats;
Exemplo n.º 6
0
 public IQueryable <GameEntity> Games([Service] MtgDbContext context) =>
 context.Games;
Exemplo n.º 7
0
 public IQueryable <DeckEntity> Decks([Service] MtgDbContext context) =>
 context.Decks;
Exemplo n.º 8
0
 public IQueryable <UserEntity> Users([Service] MtgDbContext context) =>
 context.Users;
 public GameParticipationByUserIdDataLoader(MtgDbContext db)
 {
     this.db = db;
 }
Exemplo n.º 10
0
 public UserByIdDataLoader(MtgDbContext dbContextPool)
 {
     dbContext = dbContextPool ?? throw new ArgumentNullException(nameof(dbContextPool));
 }
 public StatsByUserIdDataLoader(MtgDbContext dbContextPool)
 {
     _dbContextPool = dbContextPool ?? throw new ArgumentNullException(nameof(dbContextPool));
 }
Exemplo n.º 12
0
 public BaseController()
 {
     _context = new MtgDbContext();
 }
Exemplo n.º 13
0
 public MtgUpdaterService(HttpClient httpClient, MtgDbContext context)
 {
     this.httpClient = httpClient;
     this.context    = context;
 }
Exemplo n.º 14
0
 public DeckByUserIdDataLoader(MtgDbContext db)
 {
     this.db = db;
 }