This repository has been archived on 2023-06-30. You can view files and clone it, but cannot push or open issues or pull requests.
2chBackAPI/Controllers/GetPosts.cs

23 lines
771 B
C#
Raw Normal View History

2022-10-17 14:29:09 +10:00
using Microsoft.AspNetCore.Mvc;
using System.Text.Json;
2022-11-12 03:10:57 +10:00
using System.Web.Http;
using HttpGetAttribute = Microsoft.AspNetCore.Mvc.HttpGetAttribute;
using RouteAttribute = Microsoft.AspNetCore.Mvc.RouteAttribute;
2022-10-17 14:29:09 +10:00
namespace NeDvachAPI.Controllers
{
[ApiController]
[Route("[controller]")]
2022-10-18 12:48:46 +10:00
public class ListController : ControllerBase
2022-10-17 14:29:09 +10:00
{
[HttpGet(Name = "GetPosts")]
2022-11-18 14:46:31 +10:00
public string Get([FromUri] string board, int thread)
2022-11-02 01:00:29 +10:00
{
2022-11-18 14:46:31 +10:00
List<Post> posts = DBchat.DbList(board, thread);
2022-10-17 14:29:09 +10:00
string postsJson = JsonSerializer.Serialize(posts);
2022-11-18 14:46:31 +10:00
Console.WriteLine("Запрошен список постов из борды " + board + " и треда# " + thread );
2022-10-17 14:29:09 +10:00
return postsJson ;
}
}
}