Beispiel #1
0
        public override async Task <GetActorByIdResponse> GetActorsId(ActorId actorId, ServerCallContext context)
        {
            try
            {
                var actor = await _actor.GetActorId(actorId.Id);

                if (actor is null)
                {
                    throw new Exception("Ne moze pronaci glumca");
                }
                ActorAdd act = _mapper.Map <Actor, ActorAdd>(actor);
                return(new GetActorByIdResponse()
                {
                    Actor = act
                });
            }
            catch (Exception e)
            {
                _logger.LogError(e, "ERROR");
                return(new GetActorByIdResponse()
                {
                    Actor = null
                });
            }
        }