mvc5 - How to fetch records from database and display as an event in DHTMLXScheduler Calendar -


i using dhtmlxscheduler in mvc5 webapplication add patient , patient's appointment , displaying in calendar having trouble getting data database records not getting added according start_time , end_time.

calendar controller:

    public actionresult index()             {                 var sched = new dhxscheduler(this);                 sched.skin = dhxscheduler.skins.terrace;                 sched.loaddata = true;                 sched.enabledataprocessor = true;                 sched.initialdate = new datetime(2016, 5, 5);                 sched.config.xml_date = "%d-%m-%y %g:%i:%s%a";                 return view(sched);             }             public contentresult data()             {                  return (new schedulerajaxdata(                     new entities().appointmentslogs.select(e=> new { id = e.appointmentid, start_date = e.starttime.tostring(), end_date=e.endtime, text = e.patientname })                     // .select(e => new { e.id, e.text, e.start_date, e.end_date })                      )                  );             }   

index.cshtml:

<!doctype html> <html> <head>     <title>dhxscheduler initialization sample</title>     <style>         body {             background-color: #eee;         }     </style> </head> <body>     <div  name="timeline_tab" style="height:700px;width:900px;margin:0 auto">         @html.raw(model.render())     </div> </body> </html> <script src="~/scripts/dhtmlxscheduler/dhtmlxscheduler.js"></script> <script src="~/scripts/dhtmlxscheduler/ext/dhtmlxscheduler_timeline.js"></script> 

looks send start , end dates in different formats:

, start_date = e.starttime.tostring(), end_date=e.endtime,

starttime converted string using system culture https://msdn.microsoft.com/en-us/library/k494fzbf(v=vs.110).aspx , while endtime passed datetime , serialized scheduler helper.

does changes if pass both dates datetime?

new entities()    .appointmentslogs    .select(e=> new     {         id = e.appointmentid,        start_date = e.starttime,        end_date=e.endtime,        text = e.patientname    }); 

Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -