示例#1
0
        public IActionResult GetMyo([FromHeader] int idMyo)
        {
            // Check the id is a valid one
            if (idMyo <= 0)
            {
                return(Json(new SimpleResponser {
                    Success = false, Message = "The Myo does not exists."
                }));
            }

            // Get the Myo
            var myo = myoRepository.GetMyoById(idMyo);

            if (myo == null)
            {
                return(Json(new SimpleResponser {
                    Success = false, Message = "The Myo cannot be reached."
                }));
            }

            // Get relationships
            var checkPoints = checkpointRepository.ListCheckpointByMyo(myo.IdMyo);

            myo.CheckpointList = checkPoints;

            return(Json(new ComplexResponser <Models.Myo> {
                Success = true, Message = "The Myo was obtained correctly.", Result = myo
            }));
        }