Esempio n. 1
0
        public override async Task <GetActorsResponse> GetActors(ActorEmpty a, ServerCallContext context)
        {
            try
            {
                var actors = await _actor.GetAll();

                if (actors is null)
                {
                    throw new Exception("Neuspesno uzeti glumci!");
                }
                List <ActorAdd> actorsAdd = new List <ActorAdd>();
                foreach (var actor in actors)
                {
                    ActorAdd act = _mapper.Map <Actor, ActorAdd>(actor);
                    actorsAdd.Add(act);
                }
                return(new GetActorsResponse()
                {
                    Actors = { actorsAdd }
                });
            }
            catch (Exception e)
            {
                _logger.LogError(e, "ERROR");
                return(new GetActorsResponse()
                {
                });
            }
        }
Esempio n. 2
0
        public async Task <IEnumerable <ActorDomainModel> > GetAllAsync()
        {
            var actors = await _actorsRepository.GetAll();

            List <ActorDomainModel> actorList = new List <ActorDomainModel>();

            foreach (var actor in actors)
            {
                ActorDomainModel actorModel = new ActorDomainModel
                {
                    Id        = actor.Id,
                    FirstName = actor.FirstName,
                    LastName  = actor.LastName
                };

                actorList.Add(actorModel);
            }

            return(actorList);
        }
Esempio n. 3
0
 public List <Actor> GetAllActors()
 {
     return(_actorsRepository.GetAll().ToList());
 }
Esempio n. 4
0
 public List <ActorResponse> GetAll()
 {
     return(_actorsRepository.GetAll());
 }