Files
FirstProject/Twinty/Controllers/CommentsController.cs
T
2023-09-05 10:42:52 -04:00

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");
}
}