コード例 #1
0
        public IGraphActionResult UpdateWidget(Widget widgetData)
        {
            // validation
            if (!this.ModelState.IsValid)
            {
                return(this.BadRequest(this.ModelState));
            }

            // update the "database" with the requested changes
            _repo.InsertOrUpdateWidget(widgetData);

            // *********************************************
            // raise the event indicating that the widget was updated.
            // If you don't call this message, no registered subscriptions
            // will be notified.
            // *********************************************
            this.PublishSubscriptionEvent(
                WidgetConstants.WIDGET_INSERTED_OR_ADDED,
                widgetData);

            // return
            return(this.Ok(widgetData));
        }