Added threads listing controller
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -14,7 +14,7 @@ namespace NeDvachAPI.Controllers
|
||||
public string Get([FromUri] string board, int thread)
|
||||
{
|
||||
string ipAddress = Request.HttpContext.Connection.RemoteIpAddress.ToString();
|
||||
List<Post> posts = DBchat.DbList(board, thread);
|
||||
List<Post> posts = DBchat.PostsList(board, thread);
|
||||
string postsJson = JsonSerializer.Serialize(posts);
|
||||
Console.WriteLine("С адреса " + ipAddress + " запрошен список постов из борды " + board + " и треда# " + thread);
|
||||
return postsJson ;
|
||||
|
||||
23
Controllers/ShowThreads.cs
Normal file
23
Controllers/ShowThreads.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user