From 966ad0c588d6de48de444a1488530159a55c39e1 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 23 Mar 2017 19:16:46 -0400 Subject: [PATCH] User posting front-end --- Project-Unite/Project-Unite.csproj | 1 + Project-Unite/Views/Profile/_NewPost.cshtml | 14 ++++++++++ .../Views/Profiles/ViewProfile.cshtml | 28 +++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 Project-Unite/Views/Profile/_NewPost.cshtml diff --git a/Project-Unite/Project-Unite.csproj b/Project-Unite/Project-Unite.csproj index 9c09bdb..8cdd931 100644 --- a/Project-Unite/Project-Unite.csproj +++ b/Project-Unite/Project-Unite.csproj @@ -508,6 +508,7 @@ + diff --git a/Project-Unite/Views/Profile/_NewPost.cshtml b/Project-Unite/Views/Profile/_NewPost.cshtml new file mode 100644 index 0000000..d1ff6be --- /dev/null +++ b/Project-Unite/Views/Profile/_NewPost.cshtml @@ -0,0 +1,14 @@ +@model Project_Unite.Models.UserPost + +
+ @using (Html.BeginForm("PostContent", "Profiles")) + { + @Html.AntiForgeryToken() + @Html.ValidationSummary(); + @Html.TextAreaFor(Model=>Model.PostContents, new {@class="form-control", rows="5"}) + + } +
+ + + diff --git a/Project-Unite/Views/Profiles/ViewProfile.cshtml b/Project-Unite/Views/Profiles/ViewProfile.cshtml index 94ca858..80c8e7a 100644 --- a/Project-Unite/Views/Profiles/ViewProfile.cshtml +++ b/Project-Unite/Views/Profiles/ViewProfile.cshtml @@ -24,4 +24,32 @@
  • Topics: @Model.TopicCount
  • +
    + @if(Model.UserName == User.Identity.Name) + { + Html.RenderPartial("~/Profiles/_NewPost.cshtml", new Project_Unite.Models.UserPost()); + } + @foreach(var post in Model.Posts.OrderByDescending(x => x.PostedAt)) + { + +
    +

    Posted on @post.PostedAt:

    +

    @Html.Markdown(post.PostContents

    + +
    + } +
    \ No newline at end of file