Hi all,
I need help with the "Create" operation.
When I create a new task, the Scheduler doesn't send any data to the Controller method.
My C# object is:
public class Reservation : ISchedulerEvent
{
public virtual int IdReservation { get; set; }
public virtual int? IdWorker { get; set; }
public virtual int IdRoom { get; set; }
public virtual string Title { get; set; }
public virtual string Description { get; set; }
public virtual DateTime Start { get; set; }
public virtual string StartTimezone { get; set; }
public virtual DateTime End { get; set; }
public virtual string EndTimezone { get; set; }
public virtual string RecurrenceRule { get; set; }
public virtual string RecurrenceException { get; set; }
public virtual bool IsAllDay { get; set; }
public virtual DateTime ReservationDate { get; set; }
}
and the Javascript is:
$("#scheduler").kendoScheduler({
date: new Date("2014/3/25"),
startTime: new Date("2014/3/25 07:00 AM"),
height: 600,
views: [
"day",
{ type: "workWeek", selected: true },
"week",
"month",
"agenda"
],
timezone: "Etc/UTC",
dataSource: {
batch: true,
transport: {
read: {
url: "/Reservation/Read",
dataType: "json",
type: "POST"
},
update: {
url: "/Reservation/Update",
dataType: "json",
type: "POST"
},
create: {
url: "/Reservation/Create",
dataType: "json",
type: "POST"
},
destroy: {
url: "/Reservation/Delete",
dataType: "json",
type: "POST"
},
parameterMap: function (options, operation) {
if (operation !== "read" && options.models) {
return { models: kendo.stringify(options.models) };
}
}
},
schema: {
model: {
id: "idReservation",
fields: {
idReservation: { from: "IdReservation", type: "number", defaultValue: 1 },
worker: { from: "IdWorker", type: "number", defaultValue: 1 },
roomId: { from: "IdRoom", type: "number" },
title: { from: "Title", defaultValue: "No title" },
description: { from: "Description", defaultValue: "" },
start: { from: "Start", type: "date" },
startTimezone: { from: "StartTimezone", defaultValue: null },
end: { from: "End", type: "date" },
endTimezone: { from: "EndTimezone", defaultValue: null },
recurrenceRule: { from: "RecurrenceRule" , defaultValue: null },
recurrenceException: { from: "RecurrenceException", defaultValue: null },
isAllDay: { from: "IsAllDay", type: "boolean", defaultValue: false },
reservationDate: { from: "ReservationDate", type: "date", defaultValue: new Date() }
}
}
}
}
});
and, this is my "Create" (MVC Controller) method is:
public virtual JsonResult Create([DataSourceRequest] DataSourceRequest request, Reservation reservation)
{
...
}
Please, can anyone help me to know why the properties in the "reservation" parameter ("Create" method) are all empties?
Thanks
I need help with the "Create" operation.
When I create a new task, the Scheduler doesn't send any data to the Controller method.
My C# object is:
public class Reservation : ISchedulerEvent
{
public virtual int IdReservation { get; set; }
public virtual int? IdWorker { get; set; }
public virtual int IdRoom { get; set; }
public virtual string Title { get; set; }
public virtual string Description { get; set; }
public virtual DateTime Start { get; set; }
public virtual string StartTimezone { get; set; }
public virtual DateTime End { get; set; }
public virtual string EndTimezone { get; set; }
public virtual string RecurrenceRule { get; set; }
public virtual string RecurrenceException { get; set; }
public virtual bool IsAllDay { get; set; }
public virtual DateTime ReservationDate { get; set; }
}
and the Javascript is:
$("#scheduler").kendoScheduler({
date: new Date("2014/3/25"),
startTime: new Date("2014/3/25 07:00 AM"),
height: 600,
views: [
"day",
{ type: "workWeek", selected: true },
"week",
"month",
"agenda"
],
timezone: "Etc/UTC",
dataSource: {
batch: true,
transport: {
read: {
url: "/Reservation/Read",
dataType: "json",
type: "POST"
},
update: {
url: "/Reservation/Update",
dataType: "json",
type: "POST"
},
create: {
url: "/Reservation/Create",
dataType: "json",
type: "POST"
},
destroy: {
url: "/Reservation/Delete",
dataType: "json",
type: "POST"
},
parameterMap: function (options, operation) {
if (operation !== "read" && options.models) {
return { models: kendo.stringify(options.models) };
}
}
},
schema: {
model: {
id: "idReservation",
fields: {
idReservation: { from: "IdReservation", type: "number", defaultValue: 1 },
worker: { from: "IdWorker", type: "number", defaultValue: 1 },
roomId: { from: "IdRoom", type: "number" },
title: { from: "Title", defaultValue: "No title" },
description: { from: "Description", defaultValue: "" },
start: { from: "Start", type: "date" },
startTimezone: { from: "StartTimezone", defaultValue: null },
end: { from: "End", type: "date" },
endTimezone: { from: "EndTimezone", defaultValue: null },
recurrenceRule: { from: "RecurrenceRule" , defaultValue: null },
recurrenceException: { from: "RecurrenceException", defaultValue: null },
isAllDay: { from: "IsAllDay", type: "boolean", defaultValue: false },
reservationDate: { from: "ReservationDate", type: "date", defaultValue: new Date() }
}
}
}
}
});
and, this is my "Create" (MVC Controller) method is:
public virtual JsonResult Create([DataSourceRequest] DataSourceRequest request, Reservation reservation)
{
...
}
Please, can anyone help me to know why the properties in the "reservation" parameter ("Create" method) are all empties?
Thanks