Ejemplo n.º 1
0
        public virtual IHttpActionResult GetCurrentLocation()
        {
            var response = new GetLocationResponse();

            try
            {
                LocationDa da        = new LocationDa();
                var        latestLoc = da.GetLatestLocation();
                var        location  = LocationConverter.ConvertToReponse(latestLoc);
                var        json      = JsonConvert.SerializeObject(location, new JsonSerializerSettings {
                    Formatting = Formatting.None
                });
                response = JsonConvert.DeserializeObject <GetLocationResponse>(json);

                da.Dispose();
            }
            catch (Exception ex)
            {
            }
            return(new HttpActionResult(HttpStatusCode.OK, response));
        }