public IEnumerable <VideoDetails> GetByPopularity() { List <VideoDetails> videos = new List <VideoDetails>(); try { int count = 0; foreach (VideoDetails vid in allVideos) { if (count <= 3) { vid.items = new List <ItemDetails>(); ItemDetails i1 = new ItemDetails() { itemId = "1", itemDescription = "Item 1 description", itemName = "Item No 1", itemLocations = new List <ItemLocation>() }; i1.itemLocations.Add(new ItemLocation() { startTime = 25, endTime = 30, posX = 56, posY = 85 }); i1.itemLocations.Add(new ItemLocation() { startTime = 5, endTime = 12, posX = 35, posY = 55 }); i1.itemLocations.Add(new ItemLocation() { startTime = 55, endTime = 60, posX = 67, posY = 35 }); ItemDetails i2 = new ItemDetails() { itemId = "2", itemDescription = "Item 2 description", itemName = "Item No 2", itemLocations = new List <ItemLocation>() }; i2.itemLocations.Add(new ItemLocation() { startTime = 14, endTime = 22, posX = 76, posY = 40 }); i2.itemLocations.Add(new ItemLocation() { startTime = 7, endTime = 30, posX = 16, posY = 22 }); i2.itemLocations.Add(new ItemLocation() { startTime = 40, endTime = 48, posX = 38, posY = 75 }); vid.items.Add(i1); vid.items.Add(i2); videos.Add(vid); count++; } } } catch (Exception e) { } return(videos); }
public VideoDetails Get(string id) { VideoDetails vid = null; try { vid = allVideos.Where(x => x.videoId == id).FirstOrDefault(); if (vid != null) { vid.items = new List <ItemDetails>(); ItemDetails i1 = new ItemDetails() { itemId = "1", itemDescription = "Item 1 description", itemName = "Item No 1", itemLocations = new List <ItemLocation>() }; i1.itemLocations.Add(new ItemLocation() { startTime = 25, endTime = 30, posX = 56, posY = 85 }); i1.itemLocations.Add(new ItemLocation() { startTime = 5, endTime = 12, posX = 35, posY = 55 }); i1.itemLocations.Add(new ItemLocation() { startTime = 55, endTime = 60, posX = 67, posY = 35 }); ItemDetails i2 = new ItemDetails() { itemId = "2", itemDescription = "Item 2 description", itemName = "Item No 2", itemLocations = new List <ItemLocation>() }; i2.itemLocations.Add(new ItemLocation() { startTime = 14, endTime = 22, posX = 76, posY = 40 }); i2.itemLocations.Add(new ItemLocation() { startTime = 7, endTime = 30, posX = 16, posY = 22 }); i2.itemLocations.Add(new ItemLocation() { startTime = 40, endTime = 48, posX = 38, posY = 75 }); vid.items.Add(i1); vid.items.Add(i2); } } catch (Exception e) { } return(vid); }