* Web.config:

* Web.csproj:
* Web.config:
* Blog.cs:
* Index.aspx:
* BBCodeHelper.cs:
* Comment.cs:
* yavscModel.csproj:
* BlogEntry.cs:
* UserPost.aspx:
* UserPosts.aspx:
* Estimate.cs:
* RemovePost.aspx:
* TitleNotFound.aspx:
* BlogProvider.cs:
* AccountController.cs:
* BlogsApiController.cs:
* WorkFlowController.cs:
* BlogEditEntryModel.cs:
* FindBlogEntryFlags.cs:
* BlogEntryCollection.cs:
* Comment.cs:
* BlogEditCommentModel.cs:
* NpgsqlBlogProvider.cs:
* NpgsqlContentProvider.cs:
* BlogEntry.cs:
* NpgsqlBlogProvider.csproj:
* NpgsqlMembershipProvider.cs:
* FindBlogEntryFlags.cs:
* BlogEntryCollection.cs: 

* BlogHelper.cs: refactoring: moving code from NpgsqlBlogProvider to
  yavscModel.Blogs


* BlogManager.cs: NpgsqlBlogProvider/BlogHelper.cs


* BlogsController.cs: a successfull confirmed removal

* Blog.cs: refactoring
This commit is contained in:
Paul Schneider 2014-09-23 01:43:11 +02:00
commit 9fc7f82531
29 changed files with 213 additions and 114 deletions

View file

@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using System.Web.Security;
using Npgsql.Web.Blog;
using yavscModel.Blogs;
namespace Yavsc.Controllers
{
public class BlogsApiController : Controller
{
public static HttpStatusCodeResult RemovePost(string user, string title) {
if (!Roles.IsUserInRole ("Admin")) {
string rguser = Membership.GetUser ().UserName;
if (rguser != user) {
throw new AccessViolationException (
string.Format (
"Vous n'avez pas le droit de suprimer des billets du Blog de {0}",
user));
}
}
BlogEntry e = BlogManager.GetPost (user, title);
if (e == null) {
return new HttpNotFoundResult (
string.Format("Aucun post portant le titre \"{0}\" pour l'utilisateur {1}",
title, user));
}
BlogManager.RemovePost (user, title);
return new HttpStatusCodeResult (200);
}
}
}