diff --git a/Twinty/Controllers/CommentsController.cs b/Twinty/Controllers/CommentsController.cs new file mode 100644 index 0000000..a49f21e --- /dev/null +++ b/Twinty/Controllers/CommentsController.cs @@ -0,0 +1,29 @@ +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"); + } +} \ No newline at end of file diff --git a/Twinty/Views/Comments/Index.cshtml b/Twinty/Views/Comments/Index.cshtml new file mode 100644 index 0000000..ce9dd01 --- /dev/null +++ b/Twinty/Views/Comments/Index.cshtml @@ -0,0 +1,33 @@ + +
+ +Ceci est la chose la plus plate de tous les temps!
+Ce site est incroyable, svp dites moi s'en plus!
+@ViewData["Comment"]
+