public IHttpActionResult CreateDataJson(int itemId) { widgetManager = new WidgetManager(); string val = widgetManager.NoteboxData(itemId); List <int> vals = new List <int>(); val.Split(',').ForEach(v => vals.Add(Int32.Parse(v))); Itemstats itemstats = new Itemstats { Male = vals.ElementAt(0), Female = vals.ElementAt(1), GenderUnknown = vals.ElementAt(2), Old = vals.ElementAt(3), Young = vals.ElementAt(4), AgeUnknown = vals.ElementAt(5) }; return(Ok(itemstats)); }