コード例 #1
0
        private JsonResult ChangeRobotHeadRotation(long id, HeadVO robotHead, int newRotationNumber)
        {
            HeadRotation newHeadRotation;
            string       newHeadRotationDescription = string.Empty;

            bool isValidMovement = newRotationNumber.TryParseEnum(out newHeadRotation);

            if (isValidMovement)
            {
                robotHead.HeadRotation     = newHeadRotation;
                newHeadRotationDescription = robotHead.HeadRotation.GetDescription();

                bool isHeadMoved = _robotService.PutHead(id, robotHead);

                if (isHeadMoved == false)
                {
                    isValidMovement = false;
                }
            }

            return(Json(new { isValidMovement, description = newHeadRotationDescription }));
        }