public IActionResult Get(int skip = 0, int limit = 100000)
 {
     try
     {
         var actors = actorRepository.GetActors(skip, limit);
         return(Ok(actors));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Esempio n. 2
0
        public ResultListDto <ActorDto> Handle(GetActorListQuery query)
        {
            var actors    = _actorRepository.GetActors(query.Page, query.PageSize);
            var actorDtos = actors.Select(a => new ActorDto
            {
                Name          = a.Name,
                Balance       = a.Balance.Name,
                Experience    = a.Experience,
                CurrentHealth = a.CurrentHealth,
                Health        = a.Health,
                Power         = a.Power,
                Speed         = a.Speed,
                Quality       = a.Quality.Name
            }).ToList();

            return(new ResultListDto <ActorDto>(_actorRepository.Count(), actorDtos));
        }
Esempio n. 3
0
 public async Task <ActionResult <IEnumerable <ActorDTO> > > GetActors()
 {
     return(Ok(await _actorRepository.GetActors().ConfigureAwait(false)));
 }
Esempio n. 4
0
        public async Task <IEnumerable <ActorResource> > GetActors()
        {
            var actors = await repository.GetActors();

            return(mapper.Map <IEnumerable <Actor>, IEnumerable <ActorResource> >(actors));
        }
 // GET: Actors
 public ActionResult Index()
 {
     return(View(_actorRepository.GetActors()));
 }
Esempio n. 6
0
        // GET: Movies/Create
        public ActionResult Create(Movie movie)
        {
            CreateMovieViewModel model = new CreateMovieViewModel();

            if (movie.Name != null)
            {
                Populate     n           = new Populate();
                Composite    pop         = n.Popul(movie);
                Producer     newproducer = new Producer();
                List <Actor> newactors   = new List <Actor>();

                newproducer = pop.Producer;
                newactors   = pop.Actors;

                string   pname    = newproducer.Name;
                Producer producer = _producerRepository.GetProducers().FirstOrDefault(a => a.Name == pname);
                if (producer == null)
                {
                    _producerRepository.InsertProducer(newproducer);
                    _producerRepository.Save();
                }

                List <int> selectedActorIDs = new List <int>();


                List <Actor> actors     = _actorRepository.GetActors().ToList();
                List <Actor> tempActors = new List <Actor>();

                foreach (var b in newactors)
                {
                    string aname = b.Name;
                    Actor  actor = actors.FirstOrDefault(a => a.Name == aname);
                    if (actor == null)
                    {
                        tempActors.Add(b);
                    }
                }

                foreach (var b in tempActors)
                {
                    _actorRepository.InsertActor(b);
                    _actorRepository.Save();
                }

                actors = _actorRepository.GetActors().ToList();
                //foreach (var b in newactors)
                //    selectedActorIDs.Add(actors.FirstOrDefault(a => a.tmdb_id == b.tmdb_id).ID);

                List <int> toadd = (from na in newactors
                                    join a in actors on na.TmdbId equals a.TmdbId
                                    select a.Id).ToList();

                selectedActorIDs.AddRange(toadd);

                SelectList      producerslist = new SelectList(_producerRepository.GetProducers().OrderBy(i => i.Name), "Id", "Name", _producerRepository.GetProducers().FirstOrDefault(a => a.TmdbId == newproducer.TmdbId).Id);
                MultiSelectList actorslist    = new MultiSelectList(_actorRepository.GetActors().OrderBy(i => i.Name), "Id", "Name", selectedActorIDs);
                model.Name      = movie.Name;
                model.Plot      = movie.Plot;
                model.Year      = movie.Year;
                model.Image     = movie.Image;
                model.Producers = producerslist;
                model.Actors    = actorslist;
                model.TmdbId    = movie.TmdbId;
            }
            else
            {
                SelectList      producerslist = new SelectList(_producerRepository.GetProducers().OrderBy(i => i.Name), "Id", "Name");
                MultiSelectList actorslist    = new MultiSelectList(_actorRepository.GetActors().OrderBy(i => i.Name), "Id", "Name");
                model.Producers = producerslist;
                model.Actors    = actorslist;
            }

            return(View(model));
        }
Esempio n. 7
0
 public async Task <IEnumerable <Schema.Actor> > Actors([Inject] IActorRepository actorRepository)
 {
     return(Mapper.Map <Schema.Actor[]>(await actorRepository.GetActors()));
 }
Esempio n. 8
0
 public async Task <List <ExtendedActorDTO> > GetActors()
 {
     return(_mapper.Map <List <ExtendedActorDTO> >(await _actorRepository.GetActors()));
 }
 public async Task <ActionResult <List <GetActorModel> > > GetActors()
 {
     return(await _actorRepository.GetActors());
 }
Esempio n. 10
0
 public List <Actor> GetActors()
 {
     return(repo.GetActors());
 }