public ActionResult Index() { var genresDto = _genreService.GetAll(false); var genres = Mapper.Map <IEnumerable <GenreViewModel> >(genresDto); return(View(genres)); }
public ActionResult New() { var user = new CreateUserViewModel { CreateDate = DateTime.UtcNow }; user.AllRoles = Mapper.Map <IEnumerable <RoleViewModel> >(_roleService.GetAll(true)).ToList(); return(View(user)); }
public ActionResult Index() { var usersDto = _roleService.GetAll(false); var users = Mapper.Map <IEnumerable <RoleViewModel> >(usersDto); return(View(users)); }
public IEnumerable <PublisherViewModel> Get() { IEnumerable <PublisherDTO> publishersDto = _publisherService.GetAll(false); var publishersViewModel = Mapper.Map <IEnumerable <PublisherViewModel> >(publishersDto); return(publishersViewModel); }
public IEnumerable <GenreViewModel> Get() { IEnumerable <GenreDTO> genresDto = _genreService.GetAll(false); var genresViewModel = Mapper.Map <IEnumerable <GenreViewModel> >(genresDto); return(genresViewModel); }
private FilterViewModel GetFilterViewModel(IEnumerable <string> genresName = null, IEnumerable <string> typesName = null, IEnumerable <string> publishersName = null) { var dtoToViewModel = new DtoToViewModelMapping(); var genres = _genreService.GetAll(false).ToList(); var genreTranslates = genres.Select(x => dtoToViewModel.GetDefaultTranslate(x.Translates.ToList())); var types = _typeService.GetAll(false).ToList(); var typesTranslate = types.Select(x => dtoToViewModel.GetDefaultTranslate(x.Translates.ToList())); var publishers = _publisherService.GetAll(false).ToList(); var publishersTranslate = publishers.Select(x => dtoToViewModel.GetDefaultTranslate(x.Translates.ToList())); var model = new FilterViewModel() { ListGenres = GetListOfItems(genreTranslates), ListTypes = GetListOfItems(typesTranslate), ListPublishers = GetListOfItems(publishersTranslate) }; if (genresName != null) { model.SelectedGenres = model.ListGenres.Where(x => genresName.Contains(x.Text)); model.SelectedGenresName = genresName; } if (typesName != null) { model.SelectedType = model.ListTypes.Where(x => typesName.Contains(x.Text)); model.SelectedTypesName = typesName; } if (publishersName != null) { model.SelectedPublishers = model.ListPublishers.Where(x => publishersName.Contains(x.Text)); model.SelectedPublishersName = publishersName; } return(model); }
public ActionResult Index() { var types = _typeService.GetAll(true); return(View(Mapper.Map <IEnumerable <PlatformTypeViewModel> >(types))); }
public ActionResult Index() { var publishers = _publisherService.GetAll(true); return(View(Mapper.Map <IEnumerable <PublisherViewModel> >(publishers))); }