Beispiel #1
0
 public void ConvertColliListPassTest()
 {
     foreach (var entity in clLists)
     {
         var ColliListBO = clConv.Convert(entity);
         Assert.NotNull(ColliListBO);
         Assert.Equal(entity.ItemType, ColliListBO.ItemType);
         Assert.Equal(entity.FreightType, ColliListBO.FreightType);
         Assert.Equal(entity.Id, ColliListBO.Id);
     }
 }
        public ColliListBO Create(ColliListBO colliList)
        {
            if (colliList == null)
            {
                return(null);
            }

            using (var uow = _facade.UnitOfWork)
            {
                var createdColliList = uow.ColliListRepository.Create(_conv.ConvertBO(colliList));
                uow.Complete();
                return(_conv.Convert(createdColliList));
            }
        }
        public PackingListBO Get(int Id)
        {
            if (Id < 1)
            {
                return(null);
            }

            using (var uow = _facade.UnitOfWork)
            {
                var packingList = _convPL.Convert(uow.PackingListRepository.Get(Id));
                if (packingList != null)
                {
                    packingList.Projects = uow.ProjectRepository.GetAllById(packingList.ProjectIds)
                                           .Select(p => _conv.Convert(p))
                                           .ToList();

                    packingList.ColliLists = uow.ColliListRepository.GetAllById(packingList.ColliListIds)
                                             .Select(cl => _convCL.Convert(cl))
                                             .ToList();

                    packingList.PackItems = uow.PackItemRepository.GetAllById(packingList.PackItemsIds)
                                            .Select(pi => _convPI.Convert(pi))
                                            .ToList();
                }
                uow.Complete();
                return(packingList);
            }
        }
        public ColliItemBO Get(int Id)
        {
            if (Id < 1)
            {
                return(null);
            }

            using (var uow = _facade.UnitOfWork)
            {
                var colliItem = _conv.Convert(uow.ColliItemRepository.Get(Id));
                if (colliItem != null)
                {
                    colliItem.ColliList = _convCL.Convert(uow.ColliListRepository.Get(colliItem.ColliListId));
                    colliItem.Item      = _convIT.Convert(uow.ItemRepository.Get(colliItem.ItemId));
                }

                uow.Complete();
                return(colliItem);
            }
        }