Esempio n. 1
0
        //Se puede hacer inyección de dependencias por constructor - desde la Api se hace por setter y cuando se llame el repositorio  se le pasa por constructor.
        public async Task <AeropuertoTo> ObtenerAeropuertoPorIdAsync(int id)
        {
            AeropuertoTo aeropuerto = new AeropuertoTo();

            using (var Contexto = ViveVolarDbContext.GetDbContext())
            {
                var aeropuertoRepositorio = new AeropuertoRepository(Contexto);
                var result = await aeropuertoRepositorio.ObtenerPorId(id.ToString());

                aeropuerto = Mapper.Map <AeropuertoTo>(result);
            }
            return(aeropuerto);
        }
Esempio n. 2
0
        public void ObtenerAeropuertoPorId()
        {
            AeropuertoTo aeropuerto = _maestroRepo.ObtenerAeropuertoPorIdAsync(1).Result;

            Assert.IsTrue(aeropuerto.Nombre != null);
        }