public List<TestItem> GetItems() { List<TestItem> items = new List<TestItem>(); for (int i = 0; i <= 10; i++) { TestItem tmp = new TestItem { Name = "Name-"+i, Color="#ffff"+i }; items.Add(tmp); } return items; }
public TestItem GetItemData(string ID) { int id = 0; if (int.TryParse(ID, out id)) { List<TestItem> items = new List<TestItem>(); for (int i = 0; i <= id; i++) { TestItem tmp = new TestItem { Name = "Name-" + i, Color = "#ffff" + i }; items.Add(tmp); } //Return Last (single item) return items.Last(); } return null; }