示例#1
0
        public IHttpActionResult GetItemWidgets(int itemId)
        {
            widgetManager = new WidgetManager();
            IEnumerable <Widget> widgets = widgetManager.GetItemwidgetsForItem(itemId);

            if (widgets == null || widgets.Count() == 0)
            {
                return(StatusCode(HttpStatusCode.NoContent));
            }

            List <UserWidgetDTO> uWidgets = Mapper.Map(widgets, new List <UserWidgetDTO>());

            foreach (UserWidgetDTO widgetDto in uWidgets)
            {
                widgetDto.DashboardId = -1;
            }

            return(Ok(uWidgets));
        }