Esempio n. 1
0
        /// <summary>
        /// Get Checkpoint by id
        /// </summary>
        /// <param name="id">Checkpoint id</param>
        /// <returns>Checkpoint json view model</returns>
        public IHttpActionResult Get(int id)
        {
            try
            {
                // get
                log.Debug("_checkpointService.GetCheckpoint - checkpointId: " + id + " ");

                var checkpoint = new CheckpointViewModel(_checkpointService.GetCheckpoint(id));

                log.Debug("_checkpointService.GetCheckpoint - " + CheckpointViewModel.FormatCheckpointViewModel(checkpoint));

                log.Debug("result: 'success'");

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

                throw;
            }
        }