BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
KanbanFeatures.aspx
<ej:Kanban ID="Kanban" runat="server" KeyField="Status" AllowTitle="true">
<DataManager URL="KanbanFeatures.aspx/GetData" //To load Kanban CrudURL="KanbanFeatures.aspx/Crud" //To perform CRUD operations
Adaptor="WebMethodAdaptor" /> // Define the adaptor
…….
</ej:Kanban> |
KanbanFeatures.aspx.cs
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public static object GetData(Syncfusion.JavaScript.DataManager value) // To render all Kanban cards
{
NORTHWNDEntities1 db = new NORTHWNDEntities1();
IEnumerable Data = db.Tasks.ToList();
int count = Data.AsQueryable().Count();
Syncfusion.JavaScript.DataSources.DataOperations operation = new Syncfusion.JavaScript.DataSources.DataOperations();
Data = operation.Execute(Data, value);
return new { result = Data, count = count };
}
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public static object Crud(string key, List<Task> changed, List<Task> added, List<Task> deleted) //Add,Edit,Delete Kanban cards
{
NORTHWNDEntities1 db = new NORTHWNDEntities1();
//Performing insert operation
if (added != null && added.Count() > 0)
{
foreach (var temp in added)
{
db.Tasks.Add(temp);
}
}
//Performing update operation
if (changed != null && changed.Count() > 0)
{
foreach (var temp in changed) // Here single updated data was send to temp variable
{
Task old = db.Tasks.Where(o => o.Id == temp.Id).SingleOrDefault(); // Get old data from database table
if (old != null)
{
db.Entry(old).CurrentValues.SetValues(temp); // Set updated data into old data
}
}
}
//Performing delete operation
if (deleted != null && deleted.Count() > 0)
{
foreach (var temp in deleted)
{
db.Tasks.Remove(db.Tasks.Where(o => o.Id == temp.Id).SingleOrDefault());
}
}
db.SaveChanges(); // Save updated data on database
var dataSource = db.Tasks.ToList();
return dataSource;
}
|