コード例 #1
0
        public IHttpActionResult UpdateWidget(Guid widgetId, [FromBody] Widget widget)
        {
            var widgets = widgetsRepo.LoadWidgets();

            for (var i = 0; i < widgets.Count; i++)
            {
                if (widgets[i].WidgetId == widget.WidgetId)
                {
                    widgets[i] = widget;
                }
            }
            widgetsRepo.SaveWidgets(widgets);
            return(Ok(widget));
        }