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 @@ + +
+ +
+
+
boris
+

Ceci est la chose la plus plate de tous les temps!

+
+
+ + +
+
+
didier
+

Ce site est incroyable, svp dites moi s'en plus!

+
+
+ + +
+ + Nom +
+ +
+ + \ No newline at end of file diff --git a/Twinty/Views/Comments/PartialComment.cshtml b/Twinty/Views/Comments/PartialComment.cshtml new file mode 100644 index 0000000..658b20e --- /dev/null +++ b/Twinty/Views/Comments/PartialComment.cshtml @@ -0,0 +1,11 @@ +@{ + Layout = null; +} + + +
+
+
@ViewData["Name"]
+

@ViewData["Comment"]

+
+
diff --git a/Twinty/Views/Shared/_Layout.cshtml b/Twinty/Views/Shared/_Layout.cshtml index 0ef9648..91610ba 100644 --- a/Twinty/Views/Shared/_Layout.cshtml +++ b/Twinty/Views/Shared/_Layout.cshtml @@ -4,6 +4,60 @@ @ViewData["Title"] - Twinty + + +