public static void Register(HttpConfiguration config)
{
HttpServer server = new HttpServer(config);
IEdmModel model;
using (NORTHWNDEntities context = new NORTHWNDEntities())
{
model = GetModel();//Get model from dataSouce.
}
// Create our batch handler and associate it with the OData service.
ODataBatchHandler batchHandler = new DefaultODataBatchHandler(GlobalConfiguration.DefaultServer);
config.MapODataServiceRoute("odata", "odata", model, batchHandler);
config.EnsureInitialized();
}
public static Microsoft.OData.Edm.IEdmModel GetModel()
{
ODataModelBuilder builder = new ODataConventionModelBuilder();
var order = builder.EntitySet<Employee>("Employee");
FunctionConfiguration myFirstFunction = order.EntityType.Collection.Function("MyFirstFunction");
myFirstFunction.ReturnsCollectionFromEntitySet<Employee>("Employee");
return builder.GetEdmModel();
}
}
|
create: "CreateEvent",//create event
. . . . . . . . .
function CreateEvent(args)
{
var obj = $("#kanban").data("ejKanban")
$.ajax({
url: 'Home/DataSource',//URL
type: 'GET',
data: { "id": obj._id },
success: function (data1) {
$("#kanban").ejKanban({ dataSource: data1 })//Assign the value to dataSource
}
})
}
|
public ActionResult DataSource(string id)
{
var DataSource = OrderRepository.GetAllRecords();
return Json(DataSource, JsonRequestBehavior.AllowGet);
} |