Exemple #1
0
        private JsonResult ChangeElbowPosition(long id, ArmVO arm, int newPositionElbowNumeric, ArmSide armSide)
        {
            ElbowMovement newElbowMovement;
            string        movementDescription = string.Empty;

            bool isValidMovement = newPositionElbowNumeric.TryParseEnum(out newElbowMovement);

            if (isValidMovement)
            {
                arm.Elbow           = newElbowMovement;
                movementDescription = arm.Elbow.GetDescription();

                bool isArmMoved = armSide == ArmSide.Left ? _robotService.PutLeftArm(id, arm) : _robotService.PutRightArm(id, arm);

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

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