This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | public class Startup | |
| { | |
| public void Configuration(IAppBuilder builder) | |
| { | |
| var config = new HttpConfiguration(); | |
| //Add json media formatter CamelCase | |
| config.Formatters.Clear(); | |
| config.Formatters.Add(new JsonMediaTypeFormatter()); | |
| config.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); | |
| config.MapHttpAttributeRoutes(); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | public class ExceptionFilter: ExceptionFilterAttribute | |
| { | |
| public override void OnException(HttpActionExecutedContext actionExecutedContext) | |
| { | |
| Debug.WriteLine(actionExecutedContext.Exception); | |
| Console.WriteLine(actionExecutedContext.Exception); | |
| actionExecutedContext.Response = new System.Net.Http.HttpResponseMessage(System.Net.HttpStatusCode.InternalServerError); | |
| } | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | public class LocationService | |
| { | |
| private IDisposable _disposable; | |
| public void Start() | |
| { | |
| var adress = @"http://localhost:10280/locationserv"; //todo add a config key | |
| _disposable = WebApp.Start(adress); | |
| Console.WriteLine("Web application started on:{0}",adress); | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | static void Main(string[] args) | |
| { | |
| var location=new LocationService(); | |
| location.Start(); | |
| Console.ReadKey(); | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | public class LocationController:ApiController | |
| { | |
| [Route("api/v1/ping")] | |
| [HttpGet] | |
| public HttpResponseMessage Ping() | |
| { | |
| return Request.CreateResponse(HttpStatusCode.OK, new {Result = "pong"}); | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <?xml version="1.0" encoding="utf-8"?> | |
| <packages> | |
| <package id="Microsoft.AspNet.Cors" version="5.0.0" targetFramework="net452" /> | |
| <package id="Microsoft.AspNet.SignalR.Core" version="2.2.1" targetFramework="net452" /> | |
| <package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net452" /> | |
| <package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net452" /> | |
| <package id="Microsoft.AspNet.WebApi.Owin" version="5.2.3" targetFramework="net452" /> | |
| <package id="Microsoft.AspNet.WebApi.OwinSelfHost" version="5.2.3" targetFramework="net452" /> | |
| <package id="Microsoft.Owin" version="3.0.1" targetFramework="net452" /> | |
| <package id="Microsoft.Owin.Cors" version="3.0.1" targetFramework="net452" /> | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | static void Main(string[] args) | |
| { | |
| HostFactory.Run(x => | |
| { | |
| x.Service<LocationService>(s => | |
| { | |
| s.ConstructUsing(name => new LocationService()); | |
| //create the class that hosts service logic | |
| s.WhenStarted(a => a.Start()); //start method | |
| s.WhenStopped(a => a.Stop()); //stop method | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | public class LocationRequest | |
| { | |
| public double Latitude { get; set; } | |
| public double Longitude { get; set; } | |
| public Guid ClientId { get; set; } | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | public class LocationRequest | |
| { | |
| public double Latitude { get; set; } | |
| public double Longitude { get; set; } | |
| public Guid ClientId { get; set; } | |
| public DateTime CurrentTimeStamp { get; set; } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | public class LocationResponse | |
| { | |
| public Guid ClientId { get; set; } | |
| public LocationData[] Datas { get; set; } | |
| } | |
| public class LocationData | |
| { | 
OlderNewer