Example #1
0
        public async Task <IActionResult> GetTypesByCategory([FromQuery] RequestById request)
        {
            var types = await _lessonService.GetTypesByCategoryAsync(request.Id);

            var payload = new NameListPayload
            {
                Names = types.Select(type => new NamePayload
                {
                    Id   = type.Id,
                    Name = type.Name
                }).ToList()
            };

            return(Ok(payload));
        }
Example #2
0
        public async Task <IActionResult> GetCategories()
        {
            var categories = await _lessonService.GetCategoriesAsync();

            var payload = new NameListPayload
            {
                Names = categories.Select(category => new NamePayload
                {
                    Id   = category.Id,
                    Name = category.Name
                }).ToList()
            };

            return(Ok(payload));
        }