Post function modified
This commit is contained in:
parent
beb906a243
commit
e73f0b04ec
@ -5,7 +5,7 @@ namespace NeDvachAPI.Controllers
|
|||||||
{
|
{
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("[controller]")]
|
[Route("[controller]")]
|
||||||
public class HomeController : ControllerBase
|
public class ListController : ControllerBase
|
||||||
{
|
{
|
||||||
[HttpGet(Name = "GetPosts")]
|
[HttpGet(Name = "GetPosts")]
|
||||||
public string Get()
|
public string Get()
|
||||||
@ -13,6 +13,7 @@ namespace NeDvachAPI.Controllers
|
|||||||
Post[] posts = DBchat.DbList();
|
Post[] posts = DBchat.DbList();
|
||||||
string postsJson = JsonSerializer.Serialize(posts);
|
string postsJson = JsonSerializer.Serialize(posts);
|
||||||
return postsJson ;
|
return postsJson ;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,10 +7,9 @@ namespace NeDvachAPI.Controllers
|
|||||||
[Route("[controller]")]
|
[Route("[controller]")]
|
||||||
public class PostToController : ControllerBase
|
public class PostToController : ControllerBase
|
||||||
{
|
{
|
||||||
[HttpGet(Name = "PostPosts")]
|
[HttpPost(Name = "PostPosts")]
|
||||||
public void ReceivePost(string postJson)
|
public void ReceivePost([FromBody] Post ReceivedPost)
|
||||||
{
|
{
|
||||||
Post ReceivedPost = JsonSerializer.Deserialize<Post>(postJson);
|
|
||||||
DBchat.SendPost(ReceivedPost);
|
DBchat.SendPost(ReceivedPost);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,3 +1,15 @@
|
|||||||
2.0
|
2.0
|
||||||
2.0
|
2.0
|
||||||
2.0
|
2.0
|
||||||
|
2.0
|
||||||
|
2.0
|
||||||
|
2.0
|
||||||
|
2.0
|
||||||
|
2.0
|
||||||
|
2.0
|
||||||
|
2.0
|
||||||
|
2.0
|
||||||
|
2.0
|
||||||
|
2.0
|
||||||
|
2.0
|
||||||
|
2.0
|
||||||
|
Reference in New Issue
Block a user