Exemplo n.º 1
0
    public void InsertProduct(string name, int productTypeId, int brandId, string shortDescription, string longDescription, string price, int colorId)
    {
        try
        {
            name             = name.TrimEnd().TrimStart();
            shortDescription = shortDescription.TrimEnd().TrimStart();
        }
        catch (Exception)
        {
            throw new Exception("No es posible registrar el Producto");
        }

        ProductsDAO dao        = new ProductsDAO();
        Product     newProduct = new Product();

        newProduct.name             = name;
        newProduct.productTypeId    = productTypeId;
        newProduct.brandId          = brandId;
        newProduct.shortDescription = shortDescription;
        newProduct.longDescription  = longDescription;
        newProduct.price            = price;
        newProduct.colorId          = colorId;
        dao.CreateProduct(newProduct);
    }