Hi,
I'm using the ASP.NET MVC wrapper for the scheduler. The problem is that when I want to edit an event I just created (for example lengthen the event in the week view) the scheduler calls the Create-Method and not the Update-Method. I could imagine it has something to do with the ID of the newly created event.
How can I correct this?
The Create-Method:
The Scheduler:
Kendo UI Version is 2013.2.716
Thanks in advance.
I'm using the ASP.NET MVC wrapper for the scheduler. The problem is that when I want to edit an event I just created (for example lengthen the event in the week view) the scheduler calls the Create-Method and not the Update-Method. I could imagine it has something to do with the ID of the newly created event.
How can I correct this?
The Create-Method:
public
JsonResult Scheduler_Create([DataSourceRequest] DataSourceRequest request, SchedulerModel model)
{
Calendar_Entry entry =
new
Calendar_Entry
{
ID=Guid.NewGuid(),
Description=model.Description,
End=model.End,
Begin=model.Start,
CreationTime=DateTime.UtcNow,
UpdateTime=DateTime.UtcNow,
Name=model.Title,
Calendar_ID=model.CalendarID
};
dbContext.Add(entry);
dbContext.SaveChanges();
model.ID = entry.ID;
return
Json(
new
[] { model }.ToDataSourceResult(request, ModelState));
}
@(Html.Kendo().Scheduler<
ViCRM.Models.SchedulerModel
>()
.Name("scheduler")
.Date(DateTime.UtcNow)
.StartTime(new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, 6, 0, 0))
.Height(750)
.Views(views =>
{
views.DayView();
views.WeekView(weekView => weekView.Selected(true));
views.MonthView();
views.AgendaView();
})
.Timezone("Etc/UTC")
.DataSource(d => d
.Model(m =>
{
m.Id(f => f.ID);
})
.Read("Scheduler_Read", "Calendar")
.Create("Scheduler_Create", "Calendar")
.Destroy("Scheduler_Delete", "Calendar")
.Update("Scheduler_Update", "Calendar")
)
.EventTemplateId("EventTemplate")
.Resources(res =>
{
res.Add(m => m.CalendarID).Title("Kalender").DataSource(ds => ds.Read("getCalendars", "Calendar")).DataValueField("Value").DataTextField("Text").DataColorField("Color");
)
Thanks in advance.