コード例 #1
0
        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());
            }
        }
コード例 #2
0
 static public List <YogaVideo> AllMatching(VideoLengthInMinutes minutes)
 {
     return(YogaVideoStore
            .AllVideos()
            .FindAll(video => video.Minutes == minutes));
 }