Example #1
0
        // Products
        public int AddProduct(ProductModel product)
        {
            string query = @"INSERT INTO [CoroNacessitiesDB].dbo.Product (UserID, ProductName, ProductDescription, Price, ProductStatusID, TypeID, ProductImage) VALUES (@UserID, @ProductName, @ProductDescription, @Price, @ProductStatusID, @TypeID, @ProductImage)";

            return(CoroNacessitiesDBContext.getConnection().Execute(query, new { ProductName = product.productName, ProductDescription = product.productDescription, Price = product.price, UserID = product.userID, ProductStatusID = product.productStatusID, TypeID = product.typeID, ProductImage = product.productImage, }));
        }
Example #2
0
        public int UpdateProduct(int id, ProductModel product)
        {
            string query = @"UPDATE [CoroNacessitiesDB].dbo.Product SET ProductName = @ProductName, ProductDescription = @ProductDescription, Price = @Price, UserID = @UserID, ProductStatusID = @ProductStatusID, TypeID = @TypeID, ProductImage = @ProductImage WHERE ProductID = @ProductID";

            return(CoroNacessitiesDBContext.getConnection().Execute(query, new { ProductName = product.productName, ProductDescription = product.productDescription, Price = product.price, UserID = product.userID, ProductStatusID = product.productStatusID, TypeID = product.typeID, ProductImage = product.productImage, ProductID = id }));
        }