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; }
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; }
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(); } }