0
Hello, I’m setting up an educational application where I have a course schedule. In this project I am using a jquery calendar, and this one uses a json to assemble the dates that has scheduled event.
The pluggin (w3widgets.com/Responsive-Calendar/) uses the following json to mount events in the calendar:
"2014-12-22": { "url" : "link curso" },
"2014-12-26": { "url" : "url do curso"},
"2015-01-12": { "url" : "link deste curso"}
Using my web api application, I was able to generate the following json
{
"data": "29-12-2014",
"url": "gestao-agropecuaria"
},
{
"data": "26-12-2014",
"url": "producao-animal"
},
{
"data": "06-01-2015",
"url": "teste"
}
Below is the actionResult method and the method where the mysql query for database query is created
public IHttpActionResult Get()
{
var events = new Admin.AppClass.Agenda();
return Ok(events.ListarDatasCalendario());
}
public DataTable ListarDatasCalendario()
{
Mysql mysql = new Mysql();
try
{
return mysql.ExecutarComando(@" SELECT DATE_FORMAT(a.data, '%d-%m-%Y') as data,
c.nome as url
FROM agenda a, cursos c
WHERE a.curso = c.id
ORDER BY data DESC");
}
catch (Exception)
{
throw;
}
}
Can anyone assist me on how I can set up my json in an acceptable way to work on pluggin?
Thanks @iuristona, thanks man, it all worked out. Hugs
– Erico Souza