示例#1
0
        // private ProductRepo productRepo;

        public ProductV2Controller(ILogger <ProductV2Controller> logger,
                                   // ProductRepo productRepo,
                                   MangoBaseRepo <ProductInfoDtoV2> mongoProductRepo,
                                   MangoBaseRepo <VendorInfo> mongoVendorRepo,
                                   MangoBaseRepo <CategoryInfo> mongoCategoryRepo,
                                   MangoBaseRepo <TechnologyInfo> mongTechnologyRepo,
                                   IMapper mapper, IBus rabbitMQBus)
        {
            this.logger = logger;
            //  this.productRepo = productRepo;
            this.mapper = mapper;
            //   this.productInfoDtoV2base = mongobase;
            this.bus = rabbitMQBus;
            this.mongoProductRepo = mongoProductRepo;


            var items1 = mongoProductRepo.GetAll().ToList();
            var items2 = mongoVendorRepo.GetAll().ToList();
            var items3 = mongoCategoryRepo.GetAll().ToList();
            var items4 = mongTechnologyRepo.GetAll().ToList();


            logger.LogCritical("mongoProductRepo " + items1.Count().ToString());
            logger.LogCritical("mongoVendorRepo " + items2.Count().ToString());
            logger.LogCritical("mongoCategoryRepo " + items3.Count().ToString());
            logger.LogCritical("mongTechnologyRepo " + items4.Count().ToString());
        }
示例#2
0
 public IActionResult Get()
 {
     try
     {
         var items = mongoProductRepo.GetAll().ToList();
         logger.LogCritical("MongoCount " + items.Count().ToString());
         //  var repos = productRepo.GetAll().Select(mapper.Map<ProductInfo, ProductInfoDtoV2>);
         //var result = mapper.Map<List<ProductInfoDtoV2>>(repos);
         return(Ok(items));
     }
     catch (Exception ex)
     {
         logger.LogError("Failed to execute GET" + ex.Message);
         return(BadRequest());
     }
 }