0
FullCalendar을 사용하려고하는데 데이터베이스 및 Google 캘린더의 이벤트를 업데이트하는 피드와 함께 잘 표시됩니다.데이터베이스에 외부 (삭제 가능) 이벤트 저장
그러나 내 문제는 페이지에 단일 저장 단추를 어떻게 만듭니 까, 일정에있는 모든 이벤트를 다시 내 컨트롤러로 전달하여 데이터베이스에 저장할 수 있도록하는 것입니다.
일부 코드 (보기) :
$(document).ready(function() {
/* initialize the external events
-----------------------------------------------------------------*/
$('#external-events div.external-event').each(function() {
// create an Event Object (http://arshaw.com/fullcalendar/docs/event_data/Event_Object/)
// it doesn't need to have a start or end
var eventObject = {
title: $.trim($(this).text()) // use the element's text as the event title
};
// store the Event Object in the DOM element so we can get to it later
$(this).data('eventObject', eventObject);
// make the event draggable using jQuery UI
$(this).draggable({
zIndex: 999,
revert: true, // will cause the event to go back to its
revertDuration: 0 // original position after the drag
});
});
// -------- Calendar set up ...
$('#calendar').fullCalendar({
eventSources:
[
{ // Uk holidays
url: 'http://www.google.com/calendar/feeds/uk__en%40holiday.calendar.google.com/public/basic',
color: 'blue',
textColor: 'white'
},
{ // booked availability
url: '/avalibility/GetAvail',
color: 'red'
}
],
//... more set up
});
컨트롤러 코드 :
public JsonResult GetAvail(double start, double end)
{
var startDateTime = FromUnixTimestamp(start);
var endDateTime = FromUnixTimestamp(end);
var events = from e in db.PROJECT_CALENDAR
select e;
var AvilList = new List<object>();
foreach (var e in events)
{
AvilList.Add(
new
{
id = e.ID,
title = e.Title,
description = e.Title,
start = e.DateStart,
end = e.DateEnd
});
}
return Json(AvilList.ToArray(), JsonRequestBehavior.AllowGet);
}