some fix
This commit is contained in:
19
Controllers/DeletePost.cs
Normal file
19
Controllers/DeletePost.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Data;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace NeDvachAPI.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class DeletePostController : ControllerBase
|
||||
{
|
||||
[HttpDelete("{id}")]
|
||||
public JsonResult Get(string id)
|
||||
{
|
||||
DBchat.DeletePost(id);
|
||||
return new JsonResult("Deleted Successfully!");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,10 @@ namespace NeDvachAPI.Controllers
|
||||
{
|
||||
Post[] posts = DBchat.DbList();
|
||||
string postsJson = JsonSerializer.Serialize(posts);
|
||||
Console.WriteLine("Запрошен список постов.");
|
||||
return postsJson ;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,11 @@ namespace NeDvachAPI.Controllers
|
||||
public class PostToController : ControllerBase
|
||||
{
|
||||
[HttpPost(Name = "PostPosts")]
|
||||
public void ReceivePost([FromBody] Post ReceivedPost)
|
||||
public JsonResult ReceivePost([FromBody] Post ReceivedPost)
|
||||
{
|
||||
Console.WriteLine("Принят пост");
|
||||
DBchat.SendPost(ReceivedPost);
|
||||
return new JsonResult("Posted Successfully!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Net;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace NeDvachAPI.Controllers
|
||||
@@ -8,10 +9,11 @@ namespace NeDvachAPI.Controllers
|
||||
public class TestPostingController : ControllerBase
|
||||
{
|
||||
[HttpPost]
|
||||
public int Area(int altitude , int height)
|
||||
public int Area([FromForm] int height , int altitude)
|
||||
{
|
||||
//DBchat.SendPost(ReceivedPost);
|
||||
return altitude+height;
|
||||
Console.WriteLine("Received! " + height + " " + altitude );
|
||||
return 200;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user