Hello,
How can i call the Get method of my controller ? When i load my page, it's only calling the Post Method. I followed the web api events exemple. Thank you.
[Produces("application/json")]
[Route("api/[controller]")]
public class AstreintesController : Controller
{
private readonly PlanningContext _context;
private readonly IAgentService _agentService;
public AstreintesController(PlanningContext context, IAgentService agentService)
{
_context = context;
_agentService = agentService;
}
//GET api/Astreintes
[HttpGet]
public DataSourceResult Get([DataSourceRequest]DataSourceRequest request)
{
return _context.Astreintes.ToDataSourceResult(request);
}
[HttpPost]
public DataSourceResult Post([DataSourceRequest]DataSourceRequest request)
{
if (!ModelState.IsValid)
{
//todo: handle error
}
return _context.Astreintes.ToDataSourceResult(request);
}
@(Html.Kendo().Scheduler<
NC.Enercal.PlanningPE.Web.Areas.Planification.ViewModels.TaskViewModel
>()
.Name("scheduler")
.Date(new DateTime(2013, 6, 13))
.StartTime(new DateTime(2013, 6, 13, 7, 00, 00))
.Selectable(true)
.Editable(editable =>
{
editable.Resize(false);
})
.Height(650)
.Views(views =>
{
views.MonthView(month => month.Selected(true));
})
.Timezone("Etc/UTC")
.Resources(resource =>
{
})
.DataSource(d => d
.Events(e => e.Error("onError"))
.Model(m =>
{
m.Id(f => f.Id);
m.Field(f => f.Title).DefaultValue("No title");
m.Field(f => f.AgentId).DefaultValue(1);
})
.Read("Get", "Astreintes")
.Create("Create", "Astreintes")
)