Esempio n. 1
0
        public override async Task <ActorsMessageResponse> PostActor(ActorAdd request, ServerCallContext context)
        {
            try
            {
                var actor    = _mapper.Map <ActorAdd, Actor>(request);
                var response = await _actor.AddActor(actor);

                if (!response)
                {
                    throw new Exception("Ne moze da doda glumca");
                }
                return(new ActorsMessageResponse()
                {
                    Poruka = "Uspesno dodato", Signal = true
                });
            }
            catch (Exception e)
            {
                _logger.LogError(e, "ERROR");
                return(new ActorsMessageResponse()
                {
                    Poruka = "Doslo je do greske", Signal = false
                });
            }
        }