Exemplo n.º 1
0
        /// <summary>
        /// Get product details with id
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public IProductDTO GetProductById(int id)
        {
            var      config  = new MapperConfiguration(cfg => cfg.CreateMap <IProduct, IProductDTO>());
            var      mapper  = config.CreateMapper();
            IProduct product = _productDataAccess.GetProduct(id);

            return(mapper.Map <IProductDTO>(_productDataAccess.GetProduct(id)));
        }
Exemplo n.º 2
0
        private bool IsPriceChanged(ProductModel product, out double oldPriceFromDB)
        {
            var productFromDB = productDataAccess.GetProduct(product.Id);

            oldPriceFromDB = productFromDB.Price;
            return(productFromDB.Price != product.Price);
        }
        public IHttpActionResult GetProduct(int id)
        {
            var product = dataAccess.GetProduct(id);

            if (product == null)
            {
                return(NotFound());
            }
            return(Ok(product));
        }
Exemplo n.º 4
0
 public ProductSREntity GetProduct(ProductSearchFilter searchFilter)
 {
     _productDataAccess = new ProductDataAccess(_context);
     return(_productDataAccess.GetProduct(searchFilter));
 }
Exemplo n.º 5
0
 public ProductModel GetProduct(int Id)
 {
     return(productDataAccess.GetProduct(Id));
 }