Ejemplo n.º 1
0
 public int Update(Entities.DTO.Product product)
 {
     QueryParam[] parametreler = new QueryParam[]
     {
         new QueryParam {
             ParamName = "", ParamValue = product.CategoryID
         },
         new QueryParam {
             ParamName = "", ParamValue = product.CategoryID
         },
         new QueryParam {
             ParamName = "", ParamValue = product.CategoryID
         },
         new QueryParam {
             ParamName = "", ParamValue = product.CategoryID
         },
         new QueryParam {
             ParamName = "", ParamValue = product.CategoryID
         },
         new QueryParam {
             ParamName = "", ParamValue = product.CategoryID
         }
     };
     return(_productDal.Execute(NorthwindApp.StoredProcedures.Product.UpdateProduct, parametreler));
 }
Ejemplo n.º 2
0
        public Entities.DTO.Product Get(string id)
        {
            QueryParam[] parametreler = new QueryParam[]
            {
                new QueryParam {
                    ParamName = "ProductId", ParamValue = Encryptor.Decrypt(id)
                }
            };

            var result = _productDal.Get(NorthwindApp.StoredProcedures.Product.GetProductbyId, parametreler);

            NorthwindApp.Entities.DTO.Product productDTO = new Entities.DTO.Product();
            SimpleMapper.PropertyMap(result, productDTO);
            return(productDTO);
        }
Ejemplo n.º 3
0
        public int Add(Entities.DTO.Product product)
        {
            if ((ProductSpecs.ProductNameMustBeUnique).
                IsSatisfiedBy(product))
            {
                //Burada dynamic bir yapı olacak
                QueryParam[] parametreler = new QueryParam[]
                {
                    new QueryParam {
                        ParamName = "CategoryID", ParamValue = product.CategoryID
                    },
                    new QueryParam {
                        ParamName = "ProductName", ParamValue = product.ProductName
                    },
                    new QueryParam {
                        ParamName = "QuantityPerUnit", ParamValue = product.QuantityPerUnit
                    },
                    new QueryParam {
                        ParamName = "UnitPrice", ParamValue = product.UnitPrice
                    },
                    new QueryParam {
                        ParamName = "UnitsInStock", ParamValue = product.UnitsInStock
                    },
                    new QueryParam {
                        ParamName = "Discontinued", ParamValue = product.Discounted
                    }
                };
                EKS = _productDal.Execute(NorthwindApp.StoredProcedures.Product.AddProduct, parametreler);
            }

            //Burası değişebilir
            foreach (var businessException in BusinessRules.BusinessExceptions)
            {
                throw businessException;
            }

            return(EKS);
        }