24 lines
851 B
C#
24 lines
851 B
C#
using Microsoft.AspNetCore.Mvc;
|
||
using System.Text.Json;
|
||
using System.Web.Http;
|
||
using HttpGetAttribute = Microsoft.AspNetCore.Mvc.HttpGetAttribute;
|
||
using RouteAttribute = Microsoft.AspNetCore.Mvc.RouteAttribute;
|
||
|
||
namespace NeDvachAPI.Controllers
|
||
{
|
||
[ApiController]
|
||
[Route("[controller]")]
|
||
public class ThreadsController : ControllerBase
|
||
{
|
||
[HttpGet(Name = "GetThreads")]
|
||
public string Get([FromUri] string board)
|
||
{
|
||
string ipAddress = Request.HttpContext.Connection.RemoteIpAddress.ToString();
|
||
List<Post> posts = DBchat.ThreadsList(board);
|
||
string postsJson = JsonSerializer.Serialize(posts);
|
||
Console.WriteLine("С адреса " + ipAddress + " запрошен список тредов из борды " + board);
|
||
return postsJson;
|
||
}
|
||
}
|
||
}
|