Пример #1
0
 public async Task <RoomDeviceDTO> GetOneAsync(int id)
 {
     using (IRoomDeviceService rdevSvc = new RoomDeviceService())
     {
         return(await Task.Run(() =>
         {
             return ObjectExtend.Mapper <RoomDeviceDTO, RoomDeviceEntity>(rdevSvc.GetOneAsync(id).Result);
         }));
     }
 }
Пример #2
0
 public async Task <ProductDTO> GetOneAsync(int id)
 {
     using (IProductService rdevSvc = new ProductService())
     {
         return(await Task.Run(() =>
         {
             return ObjectExtend.Mapper <ProductDTO, ProductEntity>(rdevSvc.GetOneAsync(id).Result);
         }));
     }
 }
Пример #3
0
 public async Task <CateoryDTO> GetOneAsync(int id)
 {
     using (ICateoryService rdevSvc = new CateoryService())
     {
         return(await Task.Run(() =>
         {
             return ObjectExtend.Mapper <CateoryDTO, CateoryEntity>(rdevSvc.GetOneAsync(id).Result);
         }));
     }
 }
Пример #4
0
 public async Task <List <CateoryDTO> > GetAllAsync()
 {
     using (ICateoryService rdevSvc = new CateoryService())
     {
         return(await Task.Run(() =>
         {
             return rdevSvc.GetAll().ToList().ConvertAll(x => ObjectExtend.Mapper <CateoryDTO, CateoryEntity>(x));
         }));
     }
 }
Пример #5
0
 public async Task <int> AddAsync(RoomDeviceDTO dto)
 {
     using (IRoomDeviceService rdevSvc = new RoomDeviceService())
     {
         var model = ObjectExtend.Mapper <RoomDeviceEntity, RoomDeviceDTO>(dto);
         return(await Task.Run(() =>
         {
             return rdevSvc.AddAsync(model);
         }));
     }
 }
Пример #6
0
 public async Task <int> AddAsync(CateoryDTO dto)
 {
     using (ICateoryService rdevSvc = new CateoryService())
     {
         var model = ObjectExtend.Mapper <CateoryEntity, CateoryDTO>(dto);
         return(await Task.Run(() =>
         {
             return rdevSvc.AddAsync(model);
         }));
     }
 }
Пример #7
0
        public async Task <int> EditAsync(PortCateoryDTO dto)
        {
            var model = ObjectExtend.Mapper <PortCateoryEntity, PortCateoryDTO>(dto);

            using (IPortCateoryService rdevSvc = new PortCateoryService())
            {
                return(await Task.Run(() =>
                {
                    return rdevSvc.EditAsync(model);
                }));
            }
        }
Пример #8
0
        public ProductEntity ConvserToEntity(ProductDTO dto)
        {
            var result = ObjectExtend.Mapper <ProductEntity, ProductDTO>(dto);
            int i      = 0;

            foreach (var p in dto.ProductPorts)
            {
                result.ProductPorts.Add(ObjectExtend.Mapper <ProductPortEntity, ProductPortDTO>(p));
                result.ProductPorts[i].ParentProduct = result;
                //result.ProductPorts[i].PortCateory = ObjectExtend.Mapper<PortCateoryEntity,PortCateoryDTO>(p.PortCateory);

                i++;
            }

            return(result);
        }
Пример #9
0
        public async Task <List <ProductDTO> > GetAllAsync()
        {
            using (IProductService rdevSvc = new ProductService())
            {
                var items = await Task.Run(() =>
                {
                    return(rdevSvc.GetProductIncludePorts()
                           .ToList()
                           .ConvertAll(x =>
                                       ObjectExtend.Mapper <ProductDTO, ProductEntity>(x)
                                       ));
                });

                //CateoryManager cateoryManager = new CateoryManager();
                //foreach (var i in items)
                //    i.Cateory =await cateoryManager.GetOneAsync(i.CateoryId);

                return(items);
            }
        }