23 lines
771 B
C#
23 lines
771 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)
|
|
{
|
|
List<Post> posts = DBchat.DbList(board, thread);
|
|
string postsJson = JsonSerializer.Serialize(posts);
|
|
Console.WriteLine("Запрошен список постов из борды " + board + " и треда# " + thread );
|
|
return postsJson ;
|
|
}
|
|
}
|
|
}
|