Пример #1
0
        public static externalDTO.IdAndNameDTO.SaleIdName MapFromBLLIdName(internalDTO.SaleWithProductCount sale)
        {
            var res = sale == null ? null : new externalDTO.IdAndNameDTO.SaleIdName()
            {
                Id = sale.Id,
                SaleDescription = sale.Description
            };

            return(res);
        }
Пример #2
0
        public static externalDTO.Sale MapFromBLL(internalDTO.SaleWithProductCount sale)
        {
            var res = sale == null ? null : new externalDTO.Sale()
            {
                Id                      = sale.Id,
                AppUserId               = sale.AppUserId,
                Description             = sale.Description,
                ProductsSoldCount       = sale.ProductsSoldCount,
                SaleInitialCreationTime = sale.SaleInitialCreationTime,
                AppUserName             = sale.AppUserName,
                AppUserLastName         = sale.AppUserLastName,
                TodayTotalSaleAmount    = sale.TodayTotalSaleAmount,
                AllTotalSaleAmount      = sale.AllTotalSaleAmount
            };

            if (sale?.ProductsInSaleDTOs != null)
            {
                res.ProductsInSaleDTOs = sale.ProductsInSaleDTOs.Select(e => ProductSoldMapper.MapFromBLL(e)).ToList();
            }
            return(res);
        }