コード例 #1
0
        public ProductDTO GetProduct(Guid productID)
        {
            bool exists = productDatabaseContext.ProductExists(productID);

            if (exists == false)
            {
                throw new ProductDoesNotExistsException();
            }
            ProductDTO productDTO = productDatabaseContext.GetProduct(productID);

            return(productDTO);
        }
コード例 #2
0
        //public String GetCategoryName(Guid CategoryID)
        //{
        //    try
        //    {
        //        bool exists = productDatabaseContext.CategoryExists(CategoryID);
        //    }
        //    catch (CategoryNotFoundException ex)
        //    {
        //        throw new CategoryDoesNotExistsException();
        //    }
        //    catch (Exception ex)
        //    {
        //        throw new Exception("Unknown Error");
        //    }
        //    string name = productDatabaseContext.GetCategoryName(CategoryID);
        //    return name;
        //}

        public ProductDTO GetProduct(Guid ProductID)
        {
            try
            {
                bool exists = productDatabaseContext.ProductExists(ProductID);
            }
            catch (NotFoundException ex)
            {
                throw new ProductDoesNotExistsException();
            }
            catch (Exception ex)
            {
                throw new Exception("Unknown Error");
            }
            ProductDTO newProductDTO = productDatabaseContext.GetProduct(ProductID);

            return(newProductDTO);
        }