public ActionResult <YogaVideo> Get(VideoLengthInMinutes minutes) { var matchingVideos = YogaVideoStore.AllMatching(minutes); if (matchingVideos.Count != 0) { var choice = (new Random()).Next(matchingVideos.Count); return(matchingVideos[choice]); } else { return(NotFound()); } }
static public List <YogaVideo> AllMatching(VideoLengthInMinutes minutes) { return(YogaVideoStore .AllVideos() .FindAll(video => video.Minutes == minutes)); }