diff --git a/web/ApiControllers/AccountController.cs b/web/ApiControllers/AccountController.cs index ed25ad2e..6c45c52c 100644 --- a/web/ApiControllers/AccountController.cs +++ b/web/ApiControllers/AccountController.cs @@ -32,7 +32,7 @@ namespace Yavsc.ApiControllers /// /// Account controller. /// - public class AccountController : ApiController + public class AccountController : YavscApiController { /// @@ -89,13 +89,7 @@ namespace Yavsc.ApiControllers } - private HttpResponseMessage DefaultResponse() - { - return ModelState.IsValid ? - Request.CreateResponse (System.Net.HttpStatusCode.OK) : - Request.CreateResponse (System.Net.HttpStatusCode.BadRequest, - ValidateAjaxAttribute.GetErrorModelObject (ModelState)); - } + /// /// Resets the password. diff --git a/web/ApiControllers/YavscApiController.cs b/web/ApiControllers/YavscApiController.cs new file mode 100644 index 00000000..ed0e788a --- /dev/null +++ b/web/ApiControllers/YavscApiController.cs @@ -0,0 +1,42 @@ +// +// YavscApiController.cs +// +// Author: +// Paul Schneider +// +// Copyright (c) 2015 GNU GPL +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see . +using System; +using System.Web.Http; +using System.Net.Http; + +namespace Yavsc.ApiControllers +{ + public abstract class YavscApiController : ApiController + { + public YavscApiController () + { + } + + protected HttpResponseMessage DefaultResponse() + { + return ModelState.IsValid ? + Request.CreateResponse (System.Net.HttpStatusCode.OK) : + Request.CreateResponse (System.Net.HttpStatusCode.BadRequest, + ValidateAjaxAttribute.GetErrorModelObject (ModelState)); + } + } +} + diff --git a/web/ChangeLog b/web/ChangeLog index 1c871f9f..01beaa76 100644 --- a/web/ChangeLog +++ b/web/ChangeLog @@ -1,3 +1,23 @@ +2015-09-11 Paul Schneider + + * Global.asax.cs: ignored routes are revisited + + * YavscApiController.cs: implements a default web api response + + * Web.csproj: bask to net451 + + * AccountController.cs: refactoring + + * Web.config: removes the app setting + "ClientValidationEnabled" + + * Web.config: Makes true the clientValidationEnabled app + parameter + + * packages.config: retargeting Paypal api to net451 + + * AccountController.cs: xml doc + 2015-09-10 Paul Schneider * Circles.aspx: fixes circle updates diff --git a/web/Controllers/AccountController.cs b/web/Controllers/AccountController.cs index 429ca3a6..dbd95f0a 100644 --- a/web/Controllers/AccountController.cs +++ b/web/Controllers/AccountController.cs @@ -259,12 +259,12 @@ namespace Yavsc.Controllers } - [Authorize] - [HttpGet] /// /// Profile the specified id. /// /// Identifier. + [Authorize] + [HttpGet] public ActionResult Profile (string id) { if (id == null) @@ -277,14 +277,14 @@ namespace Yavsc.Controllers - [Authorize] - [HttpPost] /// /// Profile the specified id, model and AvatarFile. /// /// Identifier. /// Model. /// Avatar file. + [Authorize] + [HttpPost] public ActionResult Profile (string id, Profile model, HttpPostedFileBase AvatarFile) { // ASSERT("Membership.GetUser ().UserName is made of simple characters, no slash nor backslash" diff --git a/web/Global.asax.cs b/web/Global.asax.cs index 579820de..075bd10b 100644 --- a/web/Global.asax.cs +++ b/web/Global.asax.cs @@ -33,18 +33,18 @@ namespace Yavsc WebConfigurationManager.AppSettings ["DefaultController"]; if (defaultController == null) defaultController = "Home"; - routes.IgnoreRoute ("{resource}.axd/{*pathInfo}"); - routes.IgnoreRoute ("Scripts/{*pathInfo}"); - routes.IgnoreRoute ("Theme/{*pathInfo}"); - routes.IgnoreRoute ("images/{*pathInfo}"); - routes.IgnoreRoute ("users/{*pathInfo}"); - routes.IgnoreRoute ("files/{*pathInfo}"); - routes.IgnoreRoute ("avatars/{*pathInfo}"); + routes.IgnoreRoute ("{resource}.axd/{*pathInfo}"); // not used + routes.IgnoreRoute ("Scripts/{*pathInfo}"); // web user side scripts + routes.IgnoreRoute ("App_Theme/{*pathInfo}"); // sites themes + routes.IgnoreRoute ("images/{*pathInfo}"); // site images + routes.IgnoreRoute ("users/{*pathInfo}"); // user's files + routes.IgnoreRoute ("avatars/{*pathInfo}"); // user's avatar + routes.IgnoreRoute ("bfiles/{*pathInfo}"); // Blog files routes.IgnoreRoute ("xmldoc/{*pathInfo}"); // xml doc routes.IgnoreRoute ("htmldoc/{*pathInfo}"); // html doc - routes.IgnoreRoute ("favicon.ico"); - routes.IgnoreRoute ("favicon.png"); - routes.IgnoreRoute ("robots.txt"); + routes.IgnoreRoute ("favicon.ico"); // favorite icon + routes.IgnoreRoute ("favicon.png"); // favorite icon + routes.IgnoreRoute ("robots.txt"); // for search engine robots routes.MapRoute ( "Blogs", "Blogs/{action}/{user}/{title}", diff --git a/web/Views/Web.config b/web/Views/Web.config index a03b7949..787c29ba 100644 --- a/web/Views/Web.config +++ b/web/Views/Web.config @@ -34,7 +34,7 @@ - + diff --git a/web/Web.config b/web/Web.config index ca114a7a..efac13c2 100644 --- a/web/Web.config +++ b/web/Web.config @@ -37,7 +37,7 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx affects performance, set this value to true only during development. --> - + @@ -85,7 +85,7 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx - + @@ -100,9 +100,10 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx - - - + + + + @@ -253,7 +254,7 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx - + @@ -262,7 +263,7 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx - + diff --git a/web/Web.csproj b/web/Web.csproj index f6755fd4..4646907a 100644 --- a/web/Web.csproj +++ b/web/Web.csproj @@ -9,7 +9,7 @@ {349C5851-65DF-11DA-9384-00065B846F21};{603C0E0B-DB56-11DC-BE95-000D561079B0};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} Library Yavsc - v4.5 + v4.5.1 true @@ -23,7 +23,6 @@ Yavsc - true @@ -40,7 +39,6 @@ 4 false Yavsc - true bin\Yavsc.xml @@ -49,7 +47,6 @@ DEBUG,TEST,WEBAPI 4 maeweb - true @@ -96,9 +93,6 @@ ..\packages\PayPalButtonManagerSDK.2.9.109\lib\net20\PayPalButtonManagerSDK.dll - - ..\packages\PayPalCoreSDK.1.6.2\lib\net45\PayPalCoreSDK.dll - ..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll @@ -108,6 +102,9 @@ ..\packages\xunit.extensibility.core.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.dll + + ..\packages\PayPalCoreSDK.1.6.2\lib\net451\PayPalCoreSDK.dll + @@ -141,6 +138,7 @@ + @@ -209,6 +207,7 @@ + diff --git a/web/packages.config b/web/packages.config index 57ee101f..141eb3b7 100644 --- a/web/packages.config +++ b/web/packages.config @@ -11,7 +11,7 @@ - +