20 lines
568 B
C#
20 lines
568 B
C#
using Microsoft.AspNetCore.Mvc;
|
|
using System.Text.Json;
|
|
|
|
namespace NeDvachAPI.Controllers
|
|
{
|
|
[ApiController]
|
|
[Route("[controller]")]
|
|
public class PostToController : ControllerBase
|
|
{
|
|
[HttpPost(Name = "PostPosts")]
|
|
public JsonResult ReceivePost([FromBody] Post ReceivedPost)
|
|
{
|
|
string ipAddress = Request.HttpContext.Connection.RemoteIpAddress.ToString();
|
|
ReceivedPost.Ip = ipAddress;
|
|
DBchat.SendPost(ReceivedPost);
|
|
return new JsonResult("Posted Successfully!");
|
|
}
|
|
}
|
|
}
|