DiagramExtension.GetBatchUpdateResult<TNode, TNodeKey, TEdge, TEdgeKey>(MVCxDiagramNodeUpdateValues<TNode, TNodeKey>, MVCxDiagramEdgeUpdateValues<TEdge, TEdgeKey>) Method
Returns the specified result to the client side after processing a callback in an action specified by the BatchUpdateRouteValues property.
Namespace: DevExpress.Web.Mvc
Assembly: DevExpress.Web.Mvc5.v24.1.dll
NuGet Package: DevExpress.Web.Mvc5
Declaration
public static ActionResult GetBatchUpdateResult<TNode, TNodeKey, TEdge, TEdgeKey>(
MVCxDiagramNodeUpdateValues<TNode, TNodeKey> nodeUpdateValues,
MVCxDiagramEdgeUpdateValues<TEdge, TEdgeKey> edgeUpdateValues
)
where TNode : new()
where TEdge : new()
Parameters
Name | Type | Description |
---|---|---|
nodeUpdateValues | MVCxDiagramNodeUpdateValues<TNode, TNodeKey> | An object that stores information about updated diagram nodes. |
edgeUpdateValues | MVCxDiagramEdgeUpdateValues<TEdge, TEdgeKey> | An object that stores information about updated diagram edges. |
Type Parameters
Name | Description |
---|---|
TNode | The type of node. |
TNodeKey | The type of node key. |
TEdge | The type of edge. |
TEdgeKey | The type of edge key. |
Returns
Type | Description |
---|---|
ActionResult | The result of an action method. |
Remarks
@Html.DevExpress().Diagram(settings => {
settings.Name = "Diagram";
settings.BatchUpdateRouteValues = new { Controller = "DataBinding", Action = "NodesAndEdgesUpdate" };
settings.Mappings.Node.Key = "ID";
settings.Mappings.Edge.Key = "ID";
settings.Mappings.Edge.FromKey = "FromID";
settings.Mappings.Edge.ToKey = "ToID";
}).Bind(Model.Objects, Model.Connections).GetHtml()
public ActionResult NodesAndEdgesUpdate(MVCxDiagramNodeUpdateValues<EditableFlowObject, int>
nodeUpdateValues, MVCxDiagramEdgeUpdateValues<EditableFlowConnection, int> edgeUpdateValues) {
foreach(var item in nodeUpdateValues.Update)
WorkflowDataProvider.UpdateObject(item);
foreach(var itemKey in nodeUpdateValues.DeleteKeys)
WorkflowDataProvider.DeleteObject(itemKey);
foreach(var item in nodeUpdateValues.Insert) {
var insertedItem = WorkflowDataProvider.InsertObject(item);
nodeUpdateValues.MapInsertedItemKey(item, insertedItem.ID);
}
foreach(var item in edgeUpdateValues.Update)
WorkflowDataProvider.UpdateConnection(item);
foreach(var itemKey in edgeUpdateValues.DeleteKeys)
WorkflowDataProvider.DeleteConnection(itemKey);
foreach(var item in edgeUpdateValues.Insert) {
var insertedItem = WorkflowDataProvider.InsertConnection(item);
edgeUpdateValues.MapInsertedItemKey(item, insertedItem.ID);
}
return DiagramExtension.GetBatchUpdateResult(nodeUpdateValues, edgeUpdateValues);
}
Online Demo
Diagram - Node and Edge Data Sources
See Also