Example #1
0
        //Get the ProductCategory View Model with id = {id}
        public static ProductCategoryVM GetProduct(int id)
        {
            var _productMapper = new ProductMapper();
            var searchedProduct = _productMapper.GetProduct(id);

            if (searchedProduct != null)
            {
                var prodVM = new ProductCategoryVM
                {
                    Id = searchedProduct.Id,
                    Name = searchedProduct.Name,
                    Description = searchedProduct.Description,
                    Price = searchedProduct.Price,
                    Category = _productMapper.GetProductCategory(searchedProduct)
                };

                return prodVM;
            }

            return null;
        }