Skip to main content

MVCxDiagramNodeUpdateValues<TNode, TKey> Class

Contains information about updated diagram nodes.

Namespace: DevExpress.Web.Mvc

Assembly: DevExpress.Web.Mvc5.v24.2.dll

Declaration

public class MVCxDiagramNodeUpdateValues<TNode, TKey> :
    MVCxDiagramItemUpdateValues<TNode, TKey>
    where TNode : new()

Type Parameters

Name Description
TNode

The type of node.

TKey

The type of node key.

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);
        }

Run Demo: Node and Edge Data Sources

Inheritance

Object
MVCxBatchUpdateValues<TNode, TKey>
MVCxDiagramItemUpdateValues<TNode, TKey>
MVCxDiagramNodeUpdateValues<TNode, TKey>
See Also