Camelcase on answer from restservice

This commit is contained in:
2019-01-26 16:52:47 +01:00
parent 55405798e6
commit b080467c36
7 changed files with 75 additions and 13 deletions

View File

@ -0,0 +1,19 @@
using AutoMapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Vidly.Dtos;
using Vidly.Models;
namespace Vidly.App_Start
{
public class MappingProfile:Profile
{
public MappingProfile()
{
Mapper.CreateMap<Customer, CustomerDto>();
Mapper.CreateMap<CustomerDto, Customer>();
}
}
}

View File

@ -1,4 +1,6 @@
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
@ -9,6 +11,10 @@ namespace Vidly
{
public static void Register(HttpConfiguration config)
{
var settings = config.Formatters.JsonFormatter.SerializerSettings;
settings.ContractResolver = new CamelCasePropertyNamesContractResolver();
settings.Formatting = Formatting.Indented;
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(