Exemplo n.º 1
0
        public async Task <EditVM> Handle(Query request, CancellationToken cancellationToken)
        {
            DataContext    db      = factory.Get();
            List <Address> context = await db.Addresses.Include(t => t.Trader.Addresses).ToListAsync();

            var tradersDto = new EditVM {
                Addresses = Mapper.Map <List <AddressVM> >(context)
            };

            return(await Task.FromResult(tradersDto));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Constructor. It creates a dbContext Factory and initializes the database.
 /// </summary>
 public UnitOfWorkFixture()
 {
     _contextFactory = new DataContextFactory();
     _contextFactory.Get().Database.Initialize(false);
     IRepositoryProvider provider = new RepositoryProvider(new RepositoryFactories());
     provider.DataContextFactory = _contextFactory;
     _unitOfWork = new UnitOfWork(provider);
 }
Exemplo n.º 3
0
            public Task <HomeVM> Handle(Query request, CancellationToken cancellationToken)
            {
                DataContext   db         = factory.Get();
                List <Trader> allTraders = db.Traders.Include(t => t.Addresses).ToList();
                HomeVM        result     = new HomeVM {
                    Traders = Mapper.Map <List <TraderVM> >(allTraders)
                };

                return(Task.FromResult(result));
            }
Exemplo n.º 4
0
 /// <summary>
 /// Constructor. It creates a dbContext Factory and initializes the database.
 /// </summary>
 public DataContextFixture()
 {
     _contextFactory = new DataContextFactory();
     _contextFactory.Get().Database.Initialize(false);
 }