Creating New MVC CRUD Project with ORCHARD

Topics: Customizing Orchard, General, Writing modules
Jun 7, 2011 at 1:11 PM

Hi 

We are trying to build a custom portal with Orchard framework. But, we find it difficult to develop our own portal without any class reference or technical documentation. Can you please guide us?

The portal we are trying to develop will have the CRUD functionality like grid's etc.. in most of the pages and some pages we want to have the content management system. We would like to get your guidance and some help link that Orchard will be one of the best framework for our scenario.

Thanks and Regards,
Sivakumar Anirudhan


 

Jun 7, 2011 at 2:03 PM

You can implement your CRUD pages with ordinary MVC routes and controllers. Orchard modules are just MVC areas. Add the [Themed] attribute to your actions or controllers to use Orchard's templates around your view.

Jun 8, 2011 at 9:15 AM

Ok. That's great. Say, I have a page, in which I need a grid and also the functionality of adding content for admin(view only for other users) using the orchard modules. Can we do this ?   . Overall I am trying to understand if I can make use of the Orchard CMS for a Big Project where some functionality required is of normal CMS.

Thanks.

Jun 8, 2011 at 11:13 AM

By default, content items can only be created by certain administrative roles; that's a pretty standard feature of a CMS :)

For your own admin views you can access IAuthorizer to check specific permissions for the current user, and implement IPermissionProvider to create your own custom permissions.

Jun 9, 2011 at 7:22 AM

OK. So the content item and grid can be in a same page right? Please help me with some link on implementing the same. Also is there a class reference for Orchard project?

Thanks

 

Jun 9, 2011 at 7:43 AM

What do you mean by 'class reference'? You can generate a Class Diagram from Visual Studio fairly easy. Just Click on the Orchard Project and then click on View Class Diagram from Solution Explorer.

From your question about a content item and a grid, I gather you want something like this:

From the Administration Dashboard.

User clicks New Your Content Type. He then gets redirected to the page where he can create a content type. For your specific Content Part, you can create an EditTemplate in which you can render an HTML table with whatever.

For more information on building a Content part go to http://orchardproject.net/docs/Writing-a-content-part.ashx.

Note that MVC does not have any ASP.NET WebForms controls, since it's in MVC you'll have to use some form of partials or helpers to actually render the html you want.

Also consider that Orchard is a CMS. It's function is to create content items, to allow the extension of those content items by editing their Content Type template ( either via new fields, or new parts). It is however NOT a line of business application. For your specific scenario, you might be better off looking at Dynamic data.

Any CRUD line of business functionality would have to be hand written by you.

Jun 9, 2011 at 9:07 AM

@sharpoverride: a class reference is basically documentation about each class and what methods/properties they have.

@Sivastyle: no, there's no class reference - but there's some great documentation and tutorials (such as the one sharpoverride linked) that will get you started, and you can look at other modules and Orchard's built-in modules to see further examples.

You are saying you want a grid, but what exactly will be in this grid, and how do you see it being related to content? You can add a grid to any view using HTML, but I assume you want some data in that grid!

Jun 9, 2011 at 9:08 AM
Edited Jun 9, 2011 at 9:08 AM

Oh - regarding sharpoverride's other comments. CRUD can be easily implemented using MVC; I'd say that's easier than Dynamic Data (having used both).

Jun 9, 2011 at 9:12 AM

@randompete Thanks for the clarification. I didn't realize that is what he meant by class reference. Having worked through Orchard's codebase I can safely say that the only way of learning is to rely on what you can find on orchardproject.net, and by reading through the existing tests.

Jun 9, 2011 at 10:45 AM

The grid I mentioned was telerik's MVC grid. All I need is In the same Page I will have that telerik's grid, and I need the CMS functionality - say in the top pane of the grid.

In this case, the best place is to create a new project in the module section. Can you let me know if I am right ? . As this is a business application and only some 10% is CMS. I wonder if module is the right place to develop my project which will have around 50 different pages.

OR Do you think if I need to create a seperate project outside Module folder and try to include features of Orchard in it by adding some reference etc... ( I am still to explore this )

Jun 9, 2011 at 10:55 AM

There have been a few discussion about Telerik controls:

http://orchard.codeplex.com/discussions?searchText=telerik

Maybe they can help you, one of those authors might already have it as a module you can use.