simple CRUD

Topics: General, Writing modules
Jul 18, 2011 at 6:25 AM

I am having trouble creating a simple CRUD scenario for an entity because I don't think I understand how to implement a content type fully.

For example, I cant seem to get a module to implement the State entity in the so that I can modify the entries in the State table.

Does anybody have a module which implements a single entity content type that I could use to create the simplest ever CRUD scenario for the State record. I just can't work it out.

Jul 18, 2011 at 8:34 PM

Are there any video tutorials with how to put a Content Type in the system? (Not a Custom Content Type)

Im after best practice to learn from and I dont want part of record like the address or map in two Creating a Content Part or creating 1-n and n-n relations.

Jul 18, 2011 at 10:41 PM

Wahoo, I have an entry on the admin menu now and an admin index page.

I tried to create the Create Page but get hung up on

CalendarPart calendar = Services.ContentManager.New<CalendarPart>("Calendar");

line. The error says.

\src\Orchard\ContentManagement\ContentExtensions.cs. Line 18.

var part = contentItem.Get<T>();

returns null and throws an exception as a result.

I think this means that it cannot find the part.

What am I missing?

Jul 19, 2011 at 10:09 AM

Are you trying to create the calendar part on it's own? If it is attached to a content type, then you need to create a content item based on that type - and the calendar part will be created automatically.

Jul 21, 2011 at 10:12 AM

Alright, don't hit me but I didn't have the Driver and Handler created for the Calendar. The application didn't complain. It just gave that error message.l That sucked but I am moving again. Ta

Jul 21, 2011 at 1:20 PM

My worst habit is not creating handlers. Every time I've written a Content Part, I've missed the handler first time around. I've got a post-it on my monitor that just says "write the handler", and I still forget.

Sep 11, 2011 at 3:46 AM

I have a list displaying the records now but when it displays the list it doesn't show the admin area. Its like it can't find the admin wrapper for the list. Have I forgotten to copy a razor layout over into my project from the one Im copying or something?

I suppose my question is how does the page know what the template layout is to use?

Sep 11, 2011 at 4:14 AM

No worries, I worked it out.

To make the view display in the admin wrapper you need to decorate the controller with Admin eg

    public class CalendarAdminController : Controller, IUpdateModel