Beispiel #1
0
        /// <summary>
        /// Get list of Checkpoints
        /// </summary>
        /// <returns>json list of Checkpoint view models</returns>
        public IHttpActionResult GetList()
        {
            try
            {
                // get list
                List <CheckpointViewModel> checkpoints;

                log.Debug("_checkpointService.GetCheckpoints");

                // add edit url
                checkpoints = _checkpointService.GetCheckpoints()
                              .Select(checkpoint => new CheckpointViewModel(checkpoint, GetEditUrl(checkpoint.CheckpointId)))
                              .ToList();

                log.Debug("result: 'success', count: " + (checkpoints != null ? checkpoints.Count().ToString() : "null"));

                //return Json(checkpoints, JsonRequestBehavior.AllowGet);
                //return Content(JsonConvert.SerializeObject(checkpoints), "application/json");
                //return JsonConvert.SerializeObject(checkpoints);
                return(Ok(checkpoints));
            }
            catch (Exception e)
            {
                // error
                log.Error(e.ToString());

                throw;
            }
        }
 public IActionResult GetCheckpoints(double fromLat, double fromLng, double toLat, double toLng, bool isThirdParty = false)
 {
     return(Ok(_checkpointService.GetCheckpoints(fromLat, fromLng, toLat, toLng, isThirdParty)));
 }