24 lines
893 B
C#
24 lines
893 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 ListController : ControllerBase
|
||
{
|
||
[HttpGet(Name = "GetPosts")]
|
||
public string Get([FromUri] string board, int thread)
|
||
{
|
||
string ipAddress = Request.HttpContext.Connection.RemoteIpAddress.ToString();
|
||
List<Post> posts = DBchat.DbList(board, thread);
|
||
string postsJson = JsonSerializer.Serialize(posts);
|
||
Console.WriteLine("С адреса " + ipAddress + " запрошен список постов из борды " + board + " и треда# " + thread);
|
||
return postsJson ;
|
||
}
|
||
}
|
||
}
|