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

27 lines
777 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-12 03:10:57 +10:00
public string Get([FromUri] string board = null)
2022-11-02 01:00:29 +10:00
{
2022-11-02 00:56:19 +10:00
2022-10-20 11:41:05 +10:00
//Post[] posts = DBchat.DbList();
2022-11-12 03:10:57 +10:00
List<Post> posts = DBchat.DbList(board);
2022-10-17 14:29:09 +10:00
string postsJson = JsonSerializer.Serialize(posts);
2022-11-12 03:10:57 +10:00
Console.WriteLine("Запрошен список постов из борды " + board);
2022-10-17 14:29:09 +10:00
return postsJson ;
2022-10-18 01:25:59 +10:00
2022-10-20 22:24:04 +10:00
2022-10-17 14:29:09 +10:00
}
}
}