added board name parameter
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
RakVhalate 2022-11-12 03:10:57 +10:00
parent f3a5b28a99
commit 4aab13329f
3 changed files with 9 additions and 5 deletions

View File

@ -1,5 +1,8 @@
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
{
@ -8,13 +11,13 @@ namespace NeDvachAPI.Controllers
public class ListController : ControllerBase
{
[HttpGet(Name = "GetPosts")]
public string Get()
public string Get([FromUri] string board = null)
{
//Post[] posts = DBchat.DbList();
List<Post> posts = DBchat.DbList();
List<Post> posts = DBchat.DbList(board);
string postsJson = JsonSerializer.Serialize(posts);
Console.WriteLine("Запрошен список постов");
Console.WriteLine("Запрошен список постов из борды " + board);
return postsJson ;

View File

@ -8,7 +8,7 @@ namespace NeDvachAPI
// Obtain connection string information from the portal
public static List<Post> DbList()
public static List<Post> DbList(string boardName)
{
// Build connection string using parameters from portal
//Post[] posts = new Post[10];
@ -20,7 +20,7 @@ namespace NeDvachAPI
"Server={0}; User Id={1}; Database={2}; Port={3}; Password={4};SSLMode=Prefer",
AuthInfo.DB.Host,
AuthInfo.DB.User,
AuthInfo.DB.DBname,
boardName,
AuthInfo.DB.Port,
AuthInfo.DB.Password);

View File

@ -7,6 +7,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNet.WebApi.Core" Version="5.2.9" />
<PackageReference Include="Minio" Version="4.0.6" />
<PackageReference Include="Npgsql" Version="6.0.7" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />