refactoring
This commit is contained in:
parent
9a2098052d
commit
f3a2efa244
64 changed files with 121 additions and 159 deletions
|
|
@ -10,7 +10,7 @@ using System.Web.Mvc.Ajax;
|
|||
using System.Web.Profile;
|
||||
using System.Web.Security;
|
||||
using Yavsc;
|
||||
using yavscModel.RolesAndMembers;
|
||||
using Yavsc.Model.RolesAndMembers;
|
||||
using Yavsc.Helpers;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ using System.Web;
|
|||
using System.Web.Mvc;
|
||||
using System.Web.Mvc.Ajax;
|
||||
using System.Web.Security;
|
||||
using yavscModel.RolesAndMembers;
|
||||
using Yavsc.Model.RolesAndMembers;
|
||||
|
||||
namespace Yavsc.Controllers.Controllers
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
public class AdminController : Controller
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Yavsc.Admin;
|
||||
using yavscModel.Admin;
|
||||
using Yavsc.Model.Admin;
|
||||
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
|
|
@ -66,5 +66,7 @@ namespace Yavsc.Controllers
|
|||
return View (datac);
|
||||
}
|
||||
|
||||
/*[Authorize(Roles="Admin")]
|
||||
public ActionResult Estimate*/
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.Http;
|
||||
using yavscModel.WorkFlow;
|
||||
using Yavsc.Model.WorkFlow;
|
||||
|
||||
namespace Yavsc.ApiControllers
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
using System.Web.Http;
|
||||
using WorkFlowProvider;
|
||||
using yavscModel.WorkFlow;
|
||||
using System.Web.Http.Controllers;
|
||||
using System.Web.Http.ModelBinding;
|
||||
|
||||
namespace Yavsc.ApiControllers
|
||||
{
|
||||
|
||||
public class BasketImpact
|
||||
{
|
||||
public string ProductRef { get; set; }
|
||||
public int Count { get; set; }
|
||||
public string Message { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -2,20 +2,20 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Mvc.Ajax;
|
||||
using System.Web.Security;
|
||||
using System.Web.Http;
|
||||
using Npgsql.Web.Blog;
|
||||
using yavscModel.Blogs;
|
||||
using Yavsc.Model.Blogs;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
namespace Yavsc.ApiControllers
|
||||
{
|
||||
public class BlogsApiController : Controller
|
||||
public class BlogsApiController : ApiController
|
||||
{
|
||||
private const string adminRoleName = "Admin";
|
||||
protected override void Initialize (System.Web.Routing.RequestContext requestContext)
|
||||
|
||||
protected override void Initialize (System.Web.Http.Controllers.HttpControllerContext controllerContext)
|
||||
{
|
||||
base.Initialize (requestContext);
|
||||
base.Initialize (controllerContext);
|
||||
if (!Roles.RoleExists (adminRoleName)) {
|
||||
Roles.CreateRole (adminRoleName);
|
||||
}
|
||||
|
|
@ -35,7 +35,7 @@ namespace Yavsc.Controllers
|
|||
return BlogManager.Tag (postid, tag);
|
||||
}
|
||||
|
||||
public static HttpStatusCodeResult RemovePost(string user, string title) {
|
||||
public static void RemovePost(string user, string title) {
|
||||
if (!Roles.IsUserInRole ("Admin")) {
|
||||
string rguser = Membership.GetUser ().UserName;
|
||||
if (rguser != user) {
|
||||
|
|
@ -47,12 +47,11 @@ namespace Yavsc.Controllers
|
|||
}
|
||||
BlogEntry e = BlogManager.GetPost (user, title);
|
||||
if (e == null) {
|
||||
return new HttpNotFoundResult (
|
||||
throw new KeyNotFoundException (
|
||||
string.Format("Aucun post portant le titre \"{0}\" pour l'utilisateur {1}",
|
||||
title, user));
|
||||
}
|
||||
BlogManager.RemovePost (user, title);
|
||||
return new HttpStatusCodeResult (200);
|
||||
}
|
||||
|
||||
public void RemoveTag(long tagid) {
|
||||
|
|
|
|||
|
|
@ -14,8 +14,9 @@ using System.Web.Security;
|
|||
using CodeKicker.BBCode;
|
||||
using Npgsql.Web.Blog;
|
||||
using Yavsc;
|
||||
using yavscModel;
|
||||
using yavscModel.Blogs;
|
||||
using Yavsc.Model;
|
||||
using Yavsc.Model.Blogs;
|
||||
using Yavsc.ApiControllers;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
|
|
@ -250,8 +251,10 @@ namespace Yavsc.Controllers
|
|||
ViewData["returnUrl"]=returnUrl;
|
||||
if (!confirm)
|
||||
return View ("RemovePost");
|
||||
HttpStatusCodeResult res = BlogsApiController.RemovePost (user,title);
|
||||
return (res.StatusCode==200? Return(returnUrl):res);
|
||||
BlogsApiController.RemovePost (user,title);
|
||||
if (returnUrl == null)
|
||||
RedirectToAction ("Index",new { user = user });
|
||||
return Redirect (returnUrl);
|
||||
}
|
||||
|
||||
private ActionResult Return (string returnUrl)
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
using System;
|
||||
using Yavsc;
|
||||
using SalesCatalog;
|
||||
using SalesCatalog.Model;
|
||||
using System.Web.Mvc;
|
||||
using System.Web;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.IO;
|
||||
using Yavsc.Controllers;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
public class Commande
|
||||
{
|
||||
public Commande(FormCollection collection)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -5,7 +5,6 @@ using System.Web;
|
|||
using System.Web.Mvc;
|
||||
using System.IO;
|
||||
using System.Web.Security;
|
||||
using FileSystem;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ using System.IO;
|
|||
using System.Net;
|
||||
using WorkFlowProvider;
|
||||
using System.Web.Security;
|
||||
using yavscModel.WorkFlow;
|
||||
using Yavsc.Model.WorkFlow;
|
||||
|
||||
namespace Yavsc.ApiControllers
|
||||
{
|
||||
|
|
@ -33,12 +33,7 @@ namespace Yavsc.ApiControllers
|
|||
return CatalogManager.GetCatalog ().GetBrand (brandName).GetProductCategory (prodCategorie)
|
||||
;
|
||||
}
|
||||
|
||||
[AcceptVerbs("GET","POST")]
|
||||
public string Command()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
/*
|
||||
|
||||
public HttpResponseMessage Post()
|
||||
{
|
||||
|
|
@ -66,7 +61,7 @@ namespace Yavsc.ApiControllers
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
[Authorize]
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ using System.Text.RegularExpressions;
|
|||
using System.IO;
|
||||
using Yavsc.Controllers;
|
||||
using System.Collections.Generic;
|
||||
using yavscModel.WorkFlow;
|
||||
using Yavsc.Model.WorkFlow;
|
||||
using WorkFlowProvider;
|
||||
using System.Web.Security;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ using System.Web;
|
|||
|
||||
using System.Web.Http;
|
||||
using WorkFlowProvider;
|
||||
using yavscModel.WorkFlow;
|
||||
using Yavsc.Model.WorkFlow;
|
||||
using System.Web.Http.Controllers;
|
||||
using System.Web.Security;
|
||||
|
||||
|
|
@ -18,6 +18,7 @@ namespace Yavsc.ApiControllers
|
|||
|
||||
protected override void Initialize (HttpControllerContext controllerContext)
|
||||
{
|
||||
// TODO move it in a module initialization
|
||||
base.Initialize (controllerContext);
|
||||
if (!Roles.RoleExists (adminRoleName)) {
|
||||
Roles.CreateRole (adminRoleName);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue