public async Task <IActionResult> MovieActors(int id) { var actors = await _repository.Actor.GetActorsByFilmIdAsync(id).ToListAsync().ConfigureAwait(false); var viewModel = new ListActorsViewModel { Items = _mapper.Map <IEnumerable <ListActorsViewModel.ActorViewModel> >(actors) }; return(View("Index", viewModel)); }
public async Task <IActionResult> Index(string propertyName, OrderByType orderBy, int currentPage = 1, int pageSize = 25) { var actors = await _repository.Actor.GetAllActorsOrderByAsync(propertyName, orderBy).GetPagedAsync(currentPage, pageSize).ConfigureAwait(false); var viewModel = new ListActorsViewModel() { Items = _mapper.Map <IEnumerable <ListActorsViewModel.ActorViewModel> >(actors.Results), OrderByViewModel = { CurrentPropertyName = propertyName, OrderBy = orderBy }, PagingViewModel = { CurrentPage = currentPage, PageSize = pageSize, LastPage = actors.PageCount } }; return(View(viewModel)); }