* 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
This commit is contained in:
parent
e9eddf56a7
commit
ab4471e974
9 changed files with 94 additions and 38 deletions
|
|
@ -32,7 +32,7 @@ namespace Yavsc.ApiControllers
|
|||
/// <summary>
|
||||
/// Account controller.
|
||||
/// </summary>
|
||||
public class AccountController : ApiController
|
||||
public class AccountController : YavscApiController
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Resets the password.
|
||||
|
|
|
|||
42
web/ApiControllers/YavscApiController.cs
Normal file
42
web/ApiControllers/YavscApiController.cs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
//
|
||||
// YavscApiController.cs
|
||||
//
|
||||
// Author:
|
||||
// Paul Schneider <paul@pschneider.fr>
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/>.
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue