Пример #1
0
        public static internalDTO.Product MapFromDAL(externalDTO.Product product)
        {
            var res = product == null ? null : new internalDTO.Product
            {
                Id          = product.Id,
                ProductName = new internalDTO.MultiLangString(product.ProductName),
                ProductCode = product.ProductCode,
                Price       = product.Price
            };

            return(res);
        }
Пример #2
0
        public override Product Update(Product entity)
        {
            var entityInDb = RepositoryDbSet
                             .Include(m => m.ProductName)
                             .ThenInclude(t => t.Translations)
                             .FirstOrDefault(x => x.Id == entity.Id);

            entityInDb.ProductName.SetTranslation(entity.ProductName);
            entityInDb.ProductCode = entity.ProductCode;
            entityInDb.Price       = entity.Price;


            return(entity);
        }
Пример #3
0
        public static internalDTO.Product MapFromDAL(externalDTO.Product product)
        {
            var res = product == null ? null : new internalDTO.Product
            {
                Id = product.Id,
                RouteOfAdministrationId = product.RouteOfAdministrationId,
                RouteOfAdministration   = RouteOfAdministrationMapper.MapFromDAL(product.RouteOfAdministration),
                ProductClassificationId = product.ProductClassificationId,
                ProductClassification   = ProductClassificationMapper.MapFromDAL(product.ProductClassification),
                ProductNameId           = product.ProductNameId,
                ProductName             = ProductNameMapper.MapFromDAL(product.ProductName)
            };

            return(res);
        }