Exemplo n.º 1
0
        public static externalDTO.Inventory MapFromDAL(internalDTO.Inventory inventory)
        {
            var res = inventory == null ? null : new externalDTO.Inventory
            {
                Id                    = inventory.Id,
                Description           = inventory.Description,
                InventoryCreationTime = inventory.InventoryCreationTime,
                ShopId                = inventory.ShopId,
                Shop                  = ShopMapper.MapFromDAL(inventory.Shop)
            };

            return(res);
        }
Exemplo n.º 2
0
        public static BLL.App.DTO.DomainLikeDTO.Identity.AppUser MapFromDAL(DAL.App.DTO.DomainLikeDTO.Identity.AppUser appUser)
        {
            var res = appUser == null ? null : new BLL.App.DTO.DomainLikeDTO.Identity.AppUser
            {
                Id        = appUser.Id,
                FirstName = appUser.FirstName,
                LastName  = appUser.LastName,
                Email     = appUser.Email,
                Aadress   = appUser.Aadress,
                ShopId    = appUser.ShopId,
                Shop      = ShopMapper.MapFromDAL(appUser.Shop)
            };

            return(res);
        }
Exemplo n.º 3
0
        public static externalDTO.DomainLikeDTO.Comment MapFromDAL(internalDTO.DomainLikeDTO.Comment comment)
        {
            var res = comment == null ? null : new externalDTO.DomainLikeDTO.Comment
            {
                Id           = comment.Id,
                CommentTitle = comment.CommentTitle,
                CommentBody  = comment.CommentBody,
                ProductId    = comment.ProductId,
                Product      = ProductMapper.MapFromDAL(comment.Product),
                ShopId       = comment.ShopId,
                Shop         = ShopMapper.MapFromDAL(comment.Shop)
            };

            return(res);
        }
Exemplo n.º 4
0
        public static BLL.App.DTO.DomainLikeDTO.Category MapFromDAL(DAL.App.DTO.DomainLikeDTO.Category category)
        {
            var res = category == null ? null : new BLL.App.DTO.DomainLikeDTO.Category
            {
                Id           = category.Id,
                CategoryName = category.CategoryName,
                ShopId       = category.ShopId,
                Shop         = ShopMapper.MapFromDAL(category.Shop)
            };

            if (category?.ProductsInCategory != null)
            {
                res.ProductsInCategory = category.ProductsInCategory.Select(e => ProductInCategoryMapper.MapFromDAL(e)).ToList();
            }
            return(res);
        }
Exemplo n.º 5
0
        public static externalDTO.Return MapFromDAL(internalDTO.Return @return)
        {
            var res = @return == null ? null : new externalDTO.Return
            {
                Id          = @return.Id,
                Description = @return.Description,
                ShopId      = @return.ShopId,
                Shop        = ShopMapper.MapFromDAL(@return.Shop)
            };

            if (@return?.ProductsReturned != null)
            {
                res.ProductsReturned = @return.ProductsReturned.Select(e => ProductReturnedMapper.MapFromDAL(e)).ToList();
            }

            return(res);
        }
Exemplo n.º 6
0
        public static externalDTO.Defect MapFromDAL(internalDTO.Defect defect)
        {
            var res = defect == null ? null : new externalDTO.Defect
            {
                Id          = defect.Id,
                Description = defect.Description,
                ShopId      = defect.ShopId,
                Shop        = ShopMapper.MapFromDAL(defect.Shop)
            };

            if (defect?.ProductsWithDefect != null)
            {
                res.ProductsWithDefect = defect.ProductsWithDefect.Select(e => ProductWithDefectMapper.MapFromDAL(e)).ToList();
            }

            return(res);
        }
Exemplo n.º 7
0
        public static externalDTO.Order MapFromDAL(internalDTO.Order order)
        {
            var res = order == null ? null : new externalDTO.Order
            {
                Id                = order.Id,
                Description       = order.Description,
                OrderCreationTime = order.OrderCreationTime,
                ShipperId         = order.ShipperId,
                Shipper           = ShipperMapper.MapFromDAL(order.Shipper),
                ShopId            = order.ShopId,
                Shop              = ShopMapper.MapFromDAL(order.Shop),
            };

            if (order?.ProductsInOrder != null)
            {
                res.ProductsInOrder = order.ProductsInOrder.Select(e => ProductInOrderMapper.MapFromDAL(e)).ToList();
            }

            return(res);
        }
Exemplo n.º 8
0
        public static externalDTO.Product MapFromDAL(internalDTO.Product product)
        {
            var res = product == null ? null : new externalDTO.Product
            {
                Id = product.Id,
                ManuFacturerItemCode      = product.ManuFacturerItemCode,
                ShopCode                  = product.ShopCode,
                ProductName               = product.ProductName,
                BuyPrice                  = product.BuyPrice,
                PercentageAddedToBuyPrice = product.PercentageAddedToBuyPrice,
                SellPrice                 = product.SellPrice,
                Quantity                  = product.Quantity,
                Weight = product.Weight,
                Length = product.Length,
            };

            if (product?.Manufacturer != null)
            {
                res.ManuFacturerId = product.ManuFacturerId;
                res.Manufacturer   = ManuFacturerMapper.MapFromDAL(product.Manufacturer);
                res.InventoryId    = product.InventoryId;
                res.Inventory      = InventoryMapper.MapFromDAL(product.Inventory);
                res.ShopId         = product.ShopId;
                res.Shop           = ShopMapper.MapFromDAL(product.Shop);
            }

            if (product?.Comments != null)
            {
                res.Comments = product.Comments.Select(e => new BLL.App.DTO.DomainLikeDTO.Comment()
                {
                    CommentTitle = e.CommentTitle,
                    CommentBody  = e.CommentBody,
                    Id           = e.Id
                }).ToList();
            }

            return(res);
        }