29 lines
665 B
C#
29 lines
665 B
C#
namespace Twinty.Controllers;
|
|
|
|
using System.Diagnostics;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
public class CreateCommentRequest{
|
|
public string Name { get; set; }
|
|
public string Comment { get; set; }
|
|
}
|
|
|
|
public class CreateCommentResponse{
|
|
public bool? Succeed { get; set; }
|
|
}
|
|
|
|
public class CommentsController : Controller{
|
|
|
|
[HttpGet]
|
|
public IActionResult Index(){
|
|
return View();
|
|
}
|
|
|
|
[HttpPost]
|
|
[ActionName("create-comment")]
|
|
public IActionResult CreateComment([FromBody] CreateCommentRequest req){
|
|
ViewData["Name"] = req.Name;
|
|
ViewData["Comment"] = req.Comment;
|
|
return View("PartialComment");
|
|
}
|
|
} |