added board name parameter
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:
parent
f3a5b28a99
commit
4aab13329f
@ -1,5 +1,8 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
using System.Web.Http;
|
||||||
|
using HttpGetAttribute = Microsoft.AspNetCore.Mvc.HttpGetAttribute;
|
||||||
|
using RouteAttribute = Microsoft.AspNetCore.Mvc.RouteAttribute;
|
||||||
|
|
||||||
namespace NeDvachAPI.Controllers
|
namespace NeDvachAPI.Controllers
|
||||||
{
|
{
|
||||||
@ -8,13 +11,13 @@ namespace NeDvachAPI.Controllers
|
|||||||
public class ListController : ControllerBase
|
public class ListController : ControllerBase
|
||||||
{
|
{
|
||||||
[HttpGet(Name = "GetPosts")]
|
[HttpGet(Name = "GetPosts")]
|
||||||
public string Get()
|
public string Get([FromUri] string board = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
//Post[] posts = DBchat.DbList();
|
//Post[] posts = DBchat.DbList();
|
||||||
List<Post> posts = DBchat.DbList();
|
List<Post> posts = DBchat.DbList(board);
|
||||||
string postsJson = JsonSerializer.Serialize(posts);
|
string postsJson = JsonSerializer.Serialize(posts);
|
||||||
Console.WriteLine("Запрошен список постов");
|
Console.WriteLine("Запрошен список постов из борды " + board);
|
||||||
return postsJson ;
|
return postsJson ;
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ namespace NeDvachAPI
|
|||||||
// Obtain connection string information from the portal
|
// 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
|
// Build connection string using parameters from portal
|
||||||
//Post[] posts = new Post[10];
|
//Post[] posts = new Post[10];
|
||||||
@ -20,7 +20,7 @@ namespace NeDvachAPI
|
|||||||
"Server={0}; User Id={1}; Database={2}; Port={3}; Password={4};SSLMode=Prefer",
|
"Server={0}; User Id={1}; Database={2}; Port={3}; Password={4};SSLMode=Prefer",
|
||||||
AuthInfo.DB.Host,
|
AuthInfo.DB.Host,
|
||||||
AuthInfo.DB.User,
|
AuthInfo.DB.User,
|
||||||
AuthInfo.DB.DBname,
|
boardName,
|
||||||
AuthInfo.DB.Port,
|
AuthInfo.DB.Port,
|
||||||
AuthInfo.DB.Password);
|
AuthInfo.DB.Password);
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.AspNet.WebApi.Core" Version="5.2.9" />
|
||||||
<PackageReference Include="Minio" Version="4.0.6" />
|
<PackageReference Include="Minio" Version="4.0.6" />
|
||||||
<PackageReference Include="Npgsql" Version="6.0.7" />
|
<PackageReference Include="Npgsql" Version="6.0.7" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
|
||||||
|
Reference in New Issue
Block a user