Learning Kentico: Creating Simple New Info Object and Store Data using InfoProvider (Kentico API)

Whoah! I'm finally in the exercises section. After a looooonnnngg time!

I've been reading and trying to understand all the topics & subtopics under the Kentico API section (not to mention Object Query, Document Query, Caching etc - nosebleed!) but TODAY I decided to just let it go (No More Excuses! Just Do It!).

And I was able to do it. Finished the first exercise. Weeee..

So, how was it? 

The one that confused me was how can I connect the previous exercises that I did to this? (Create a Doctor Info using Kentico API) because in his example, he was using the built in Kentico user membership module and added a new field and set values to it.

For this exercise, I need to define a DoctorInfo object and populate it with sample firstname, lastname, email etc.

So I created it with the below but got these two errors: Namespace not found & DoctorInfoProvider does not exist in current context. 

namespace reference

I know I have to put something in there at the top as he was using CMS.Membership, but I wasn't sure what to put in there that time. Good thing, that there's a Quick Actions that you can follow. So I use the namespace reference using MDDoctorsAppointment;  but  I got 5 more errors (see below)

no method

That's when I realized that I was just creating my own fields names. It should be the same fieldnames that I use for MDDoctorsAppointment module. Whew!

table field names


Then I added new line to insert the Doctor's info and everything is working now! Yey!
 // Insert doctor
        DoctorInfoProvider.SetDoctorInfo(doctor);


simple Kentico API implementation

1 comment:

Post Top Ad