示例#1
0
        public IActionResult GetActorById(int id)
        {
            ResponseSingleObject <ActorDTO> responseSingleObject = new ResponseSingleObject <ActorDTO>()
            {
                Status   = StatusCodes.Status500InternalServerError,
                Errors   = null,
                Message  = null,
                Succeded = false,
                Value    = null
            };

            try
            {
                ActorDTO a = _bllManager.getActorFromId(id);
                if (a == null)
                {
                    responseSingleObject.Status = StatusCodes.Status404NotFound;
                    responseSingleObject.Errors = "aucun acteur trouvé pour l'id : " + id;
                }
                else
                {
                    responseSingleObject.Status = StatusCodes.Status200OK;
                    responseSingleObject.Value  = a;
                }
            }
            catch (Exception e)
            {
                responseSingleObject.Errors =
                    "getNumberActorsFromTo() EXCEPTION : " + e.ToString();
            }

            return(StatusCode(responseSingleObject.Status, responseSingleObject));
        }