aboutsummaryrefslogtreecommitdiffstats
path: root/src/Endpoints/GetRadioSeriesList.cs
blob: 1005a45f61350d822cf15ed0a3a35e64449e697d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
using Microsoft.AspNetCore.Mvc;

namespace I2R.LightNews.Endpoints;

public class RadioSearchEndpoint : EndpointBase
{
    public RadioSearchEndpoint() { }

    public class Response
    {
        public int Id { get; set; }
        public string Name { get; set; }
    }

    [HttpGet("~/radio-series")]
    public async Task<ActionResult<List<Response>>> HandleAsync(string q) {
        var series = RadioIndexDb.GetSeries(q);
        return Ok(series.Select(c => new Response() {
            Id = c.Id,
            Name = c.Name
        }));
    }
}