This commit is contained in:
@@ -12,10 +12,11 @@ namespace NeDvachAPI.Controllers
|
||||
{
|
||||
[HttpGet(Name = "GetPosts")]
|
||||
public string Get([FromUri] string board, int thread)
|
||||
{
|
||||
{
|
||||
string ipAddress = Request.HttpContext.Connection.RemoteIpAddress.ToString();
|
||||
List<Post> posts = DBchat.DbList(board, thread);
|
||||
string postsJson = JsonSerializer.Serialize(posts);
|
||||
Console.WriteLine("Запрошен список постов из борды " + board + " и треда# " + thread );
|
||||
Console.WriteLine("С адреса " + ipAddress + " запрошен список постов из борды " + board + " и треда# " + thread);
|
||||
return postsJson ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,8 @@ namespace NeDvachAPI.Controllers
|
||||
[HttpPost(Name = "PostPosts")]
|
||||
public JsonResult ReceivePost([FromBody] Post ReceivedPost)
|
||||
{
|
||||
Console.WriteLine("Принят пост");
|
||||
string ipAddress = Request.HttpContext.Connection.RemoteIpAddress.ToString();
|
||||
ReceivedPost.Ip = ipAddress;
|
||||
DBchat.SendPost(ReceivedPost);
|
||||
return new JsonResult("Posted Successfully!");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user