Fixes the blog post removal

vnext
Paul Schneider 10 years ago
parent 9fc7f82531
commit a4d2e1b6da
5 changed files with 16 additions and 10 deletions

@ -245,6 +245,10 @@ namespace Yavsc.Controllers
[Authorize] [Authorize]
public ActionResult RemovePost (string user, string title, string returnUrl, bool confirm=false) public ActionResult RemovePost (string user, string title, string returnUrl, bool confirm=false)
{ {
if (returnUrl == null)
if (Request.UrlReferrer!=null)
returnUrl = Request.UrlReferrer.AbsoluteUri;
ViewData["returnUrl"]=returnUrl;
if (!confirm) if (!confirm)
return View ("RemovePost"); return View ("RemovePost");
HttpStatusCodeResult res = BlogsApiController.RemovePost (user,title); HttpStatusCodeResult res = BlogsApiController.RemovePost (user,title);

@ -18,7 +18,7 @@
if (Membership.GetUser().UserName==e.UserName) if (Membership.GetUser().UserName==e.UserName)
{ %> { %>
<%= Html.ActionLink("Editer","Edit", new { user = e.UserName, title = e.Title }, new { @class="actionlink" }) %> <%= Html.ActionLink("Editer","Edit", new { user = e.UserName, title = e.Title }, new { @class="actionlink" }) %>
<%= Html.ActionLink("Supprimer","Remove", new { user = e.UserName, title = e.Title }, new { @class="actionlink" } ) %> <%= Html.ActionLink("Supprimer","RemovePost", new { user = e.UserName, title = e.Title }, new { @class="actionlink" } ) %>
<% } %> <% } %>
</div> </div>

@ -9,20 +9,22 @@
</asp:Content> </asp:Content>
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server"> <asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
<form runat="server">
<%= Html.ValidationSummary() %> <%= Html.ValidationSummary() %>
<% using (Html.BeginForm("Remove","Blogs")) { %> <% using (Html.BeginForm("RemovePost","Blogs")) { %>
suivant :
<%= Html.LabelFor(model => model.Title) %>:<br/> <%= Html.LabelFor(model => model.Title) %> :
<%= Html.TextBox( "Title" ) %> <%= Html.TextBox( "Title" ) %>
<%= Html.ValidationMessage("Title", "*") %> <%= Html.ValidationMessage("Title", "*") %><br/>
<label for="confirm">supprimer le billet</label> <label for="confirm">supprimer le billet</label>
<input type="checkbox" name="confirm" /> <%= Html.CheckBox( "confirm" ) %>
<%= Html.ValidationMessage("AgreeToRemove", "*") %> <%= Html.ValidationMessage("AgreeToRemove", "*") %>
<%= Html.Hidden("returnUrl") %>
<input type="submit"/> <input type="submit"/>
<% } %> <% } %>
</form>
</asp:Content> </asp:Content>

@ -10,7 +10,7 @@
if (Membership.GetUser().UserName==Model.UserName) if (Membership.GetUser().UserName==Model.UserName)
{ %> { %>
<%= Html.ActionLink("Editer","Edit", new { user=Model.UserName, title = Model.Title }, new { @class="actionlink" }) %> <%= Html.ActionLink("Editer","Edit", new { user=Model.UserName, title = Model.Title }, new { @class="actionlink" }) %>
<%= Html.ActionLink("Supprimer","Remove", new { user=Model.UserName, title = Model.Title }, new { @class="actionlink" } ) %> <%= Html.ActionLink("Supprimer","RemovePost", new { user=Model.UserName, title = Model.Title }, new { @class="actionlink" } ) %>
<% } %> <% } %>
</div> </div>
</asp:Content> </asp:Content>

@ -21,7 +21,7 @@
if (Membership.GetUser().UserName==e.UserName) if (Membership.GetUser().UserName==e.UserName)
{ %> { %>
<%= Html.ActionLink("Editer","Edit", new { user = e.UserName, title = e.Title }, new { @class="actionlink" }) %> <%= Html.ActionLink("Editer","Edit", new { user = e.UserName, title = e.Title }, new { @class="actionlink" }) %>
<%= Html.ActionLink("Supprimer","Remove", new { user = e.UserName, title = e.Title }, new { @class="actionlink" } ) %> <%= Html.ActionLink("Supprimer","RemovePost", new { user = e.UserName, title = e.Title }, new { @class="actionlink" } ) %>
<% } %> <% } %>
</div> </div>
<% } %> <% } %>

Loading…