MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

Way to add calendar events to the repository? (Closed) (Mono Support )

Viewed 6037 time(s), 4 post(s) 4/18/2012 4:08:23 PMby Jeremy
Jeremy

Jeremy

4/18/2012 4:08:23 PM

Can anyone tell me the function to call to save a new event to the calendar event repository?

I have been able to create a new calendar using

repository.CreateCalendar(ownerId, name, slug)<BR>

I am having trouble finding a similar function to create an event that will save into the repository.

I can populate an event like this:

var newEvent = repository.GetNewCalendarEvent(authorId, calendarId);
newEvent.Title =
"Some title";
newEvent.Description = "Some
description";
newEvent.AllDay =
true;
newEvent.StartTime =
currentDay;
newEvent.EndTime = currentDay.AddDays(1);

What is the correct way to save a populated event back into the repository?

This content has not been rated yet. 
322 Reputation 36 Total posts
pajo

pajo

4/18/2012 4:34:49 PM
Hi Jeremy,

You're on right track. GetNewCalendarEvent will give you only in-memory instance of new event and it will not save it in database. Also this method will ensure newEvent has all required fields and it's attached to calendar. Sometimes you don't want to save new event to persistent storage at the time of creation, you may need to validate it before saving it. To save it to database you need to use generic SaveEntity method, you just need to add this code after populating your event

repository.SaveEntity(newEvent);

If you don't have create or save method for entity you can use generic SaveEntity on any repository to save it to persistent storage.
Rated 5.00, 1 vote(s). 
629 Reputation 83 Total posts
Jeremy

Jeremy

4/18/2012 11:03:51 PM
Thank you. That was the missing piece of the puzzle. I have been able to save the new event back into the repository now and have seen it in the database table.
This content has not been rated yet. 
322 Reputation 36 Total posts
Leonardo

Leonardo

1/17/2014 4:35:43 PM
Hello. Can anyone tell me how to save recurring events on the calendar. Thanks in advance ...
This content has not been rated yet. 
20 Reputation 2 Total posts