예제 #1
0
        // GET api/lessons
        public IEnumerable <LessonSessionDTO> Get(string tags = null, int suburb = 0, int offset = 0, int size = 10)
        {
            if (tags == null && suburb == 0)
            {
                return(Get(offset, size));
            }
            else
            {
                string[]     tagsArray = string.IsNullOrEmpty(tags) ? null : tags.Split(',');
                LessonFilter filter    = new LessonFilter()
                {
                    Tags = tagsArray, SuburbId = suburb, Offset = offset, Size = Math.Min(size, 100)
                };
                var lessons       = _lessonRepository.SearchLessons(filter);
                var lessonHeaders = lessons.ConvertAll(l => new LessonSessionDTO(l));

                return(lessonHeaders);
            }
        }