init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
55
KretaWeb/App_Start/WebApiConfig.cs
Normal file
55
KretaWeb/App_Start/WebApiConfig.cs
Normal file
|
@ -0,0 +1,55 @@
|
|||
using System.Globalization;
|
||||
using System.Web.Http;
|
||||
using Kreta.Core.JsonConverter;
|
||||
using Kreta.Core.ModelBinder;
|
||||
using Kreta.Web.ModelBinder;
|
||||
using Newtonsoft.Json;
|
||||
using CoreConstants = Kreta.Core.Constants;
|
||||
|
||||
namespace Kreta.Web.App_Start
|
||||
{
|
||||
public class WebApiConfig
|
||||
{
|
||||
public static void Register(HttpConfiguration config)
|
||||
{
|
||||
// Web API configuration and services
|
||||
System.Net.Http.Formatting.JsonMediaTypeFormatter formatter = GlobalConfiguration.Configuration.Formatters.JsonFormatter;
|
||||
|
||||
formatter.SerializerSettings = new JsonSerializerSettings
|
||||
{
|
||||
Formatting = Formatting.Indented,
|
||||
TypeNameHandling = TypeNameHandling.None,
|
||||
Culture = CultureInfo.CreateSpecificCulture(CoreConstants.General.HungarianCulture)
|
||||
};
|
||||
|
||||
formatter.SerializerSettings.Converters.Add(new StringTrimConverter());
|
||||
|
||||
// Web API routes
|
||||
config.MapHttpAttributeRoutes();
|
||||
|
||||
config.Routes.MapHttpRoute(
|
||||
name: Constants.RouteKey.ActionApi,
|
||||
routeTemplate: "api/{controller}/{action}/{id}",
|
||||
defaults: new { id = RouteParameter.Optional }
|
||||
);
|
||||
|
||||
config.Routes.MapHttpRoute(
|
||||
name: Constants.RouteKey.DefaultApi,
|
||||
routeTemplate: "api/{controller}/{id}",
|
||||
defaults: new { id = RouteParameter.Optional }
|
||||
);
|
||||
|
||||
config.BindParameter(typeof(double), new DoubleModelBinder());
|
||||
config.BindParameter(typeof(double?), new DoubleModelBinder());
|
||||
|
||||
config.BindParameter(typeof(decimal), new DecimalModelBinder());
|
||||
config.BindParameter(typeof(decimal?), new DecimalModelBinder());
|
||||
|
||||
config.BindParameter(typeof(int), new IntegerModelBinder());
|
||||
config.BindParameter(typeof(int?), new IntegerModelBinder());
|
||||
|
||||
config.BindParameter(typeof(string), new StringTrimModelBinder());
|
||||
config.BindParameter(typeof(Kendo.Mvc.UI.DataSourceRequest), new DataSourceRequestModelBinder());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue