Building an MVC application using QuickBooks
- by dataintegration
RSSBus ADO.NET Providers can be used from many tools and IDEs. In this article we show how to connect to QuickBooks from an MVC3 project using the RSSBus ADO.NET Provider for QuickBooks. Although this example uses the QuickBooks Data Provider, the same process can be used with any of our ADO.NET Providers.
Creating the Model
Step 1: Download and install the QuickBooks Data Provider from RSSBus.
Step 2: Create a new MVC3 project in Visual Studio. Add a data model to the Models folder using the ADO.NET Entity Data Model wizard.
Step 3: Create a new RSSBus QuickBooks Data Source by clicking "New Connection", specify the connection string options, and click Next.
Step 4: Select all the tables and views you need, and click Finish to create the data model.
Step 5: Right click on the entity diagram and select 'Add Code Generation Item'. Choose the 'ADO.NET DbContext Generator'.
Creating the Controller and the Views
Step 6: Add a new controller to the Controllers folder. Give it a meaningful name, such as ReceivePaymentsController. Also, make sure the template selected is 'Controller with empty read/write actions'.
Before adding new methods to the Controller, create views for your model. We will add the List, Create, and Delete views.
Step 7: Right click on the Views folder and go to Add -> View. Here create a new view for each: List, Create, and Delete templates. Make sure to also associate your Model with the new views.
Step 10: Now that the views are ready, go back and edit the RecievePayment controller. Update your code to handle the Index, Create, and Delete methods.
Sample Project
We are including a sample project that shows how to use the QuickBooks Data Provider in an MVC3 application. You may download the
C# project here or download the VB.NET project here.
You will also need to install the QuickBooks ADO.NET Data Provider to run the demo.
You can download a free trial here. To use this demo, you will also need to modify the connection string in the 'web.config'.