24 lines
675 B
C#
24 lines
675 B
C#
using Microsoft.AspNetCore.Mvc;
|
|
using System.Collections.Generic;
|
|
|
|
using spanreed.Shared;
|
|
using spanreed.Server.Data;
|
|
|
|
namespace spanreed.Server.Controllers {
|
|
[ApiController]
|
|
[Route("[controller]")]
|
|
public class ChatController : ControllerBase {
|
|
private readonly PrevChat prevChat;
|
|
public ChatController(PrevChat chatArchive) {
|
|
this.prevChat = chatArchive;
|
|
}
|
|
[HttpGet("{room}")]
|
|
public IEnumerable<ChatData> Get([FromRoute] string room)
|
|
{
|
|
if (prevChat.Chats.ContainsKey(room)) {
|
|
return prevChat.Chats[room];
|
|
}
|
|
return new ChatData[0];
|
|
}
|
|
}
|
|
} |