示例#1
0
        public GetProductResponse GetProductById(GetProductRequest request)
        {
            if (!HttpContext.Current.User.Identity.IsAuthenticated)
                throw new FaultException<NotAuthenticatedFault>(new NotAuthenticatedFault());
            GetProductResponse response = new GetProductResponse();
            ProductBusinessComponent bc = DependencyInjectionHelper.GetProductBusinessComponent();
            Product product = bc.GetProductById(request.Id);
            response.Product = ProductAdapter.ProductToDto(product);

            return response;
        }
示例#2
0
        public GetProductResponse GetProductById(GetProductRequest request)
        {
            GetProductResponse response = new GetProductResponse();
            ProductBusinessComponent bc = DependencyInjectionHelper.GetProductBusinessComponent();

            Product product = bc.GetProductById(request.Id);
            response.Product = ProductAdapter.ProductToDto(product);

            return response;
        }
示例#3
0
 public ProductDTO GetProductById(int id)
 {
     try
     {
         GetProductRequest request = new GetProductRequest();
         request.Id = id;
         GetProductResponse response = Service.GetProductById(request);
         return response.Product;
     }
     catch (Exception ex)
     {
         if (ExceptionPolicy.HandleException(ex, "PL Policy")) throw;
         return new ProductDTO();
     }
 }