Exemple #1
0
        public ActionResult Index()
        {
            var genresDto = _genreService.GetAll(false);
            var genres    = Mapper.Map <IEnumerable <GenreViewModel> >(genresDto);

            return(View(genres));
        }
Exemple #2
0
        public ActionResult New()
        {
            var user = new CreateUserViewModel
            {
                CreateDate = DateTime.UtcNow
            };

            user.AllRoles = Mapper.Map <IEnumerable <RoleViewModel> >(_roleService.GetAll(true)).ToList();
            return(View(user));
        }
Exemple #3
0
        public ActionResult Index()
        {
            var usersDto = _roleService.GetAll(false);
            var users    = Mapper.Map <IEnumerable <RoleViewModel> >(usersDto);

            return(View(users));
        }
Exemple #4
0
        public IEnumerable <PublisherViewModel> Get()
        {
            IEnumerable <PublisherDTO> publishersDto = _publisherService.GetAll(false);
            var publishersViewModel = Mapper.Map <IEnumerable <PublisherViewModel> >(publishersDto);

            return(publishersViewModel);
        }
Exemple #5
0
        public IEnumerable <GenreViewModel> Get()
        {
            IEnumerable <GenreDTO> genresDto = _genreService.GetAll(false);
            var genresViewModel = Mapper.Map <IEnumerable <GenreViewModel> >(genresDto);

            return(genresViewModel);
        }
Exemple #6
0
        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);
        }
Exemple #7
0
        public ActionResult Index()
        {
            var types = _typeService.GetAll(true);

            return(View(Mapper.Map <IEnumerable <PlatformTypeViewModel> >(types)));
        }
Exemple #8
0
        public ActionResult Index()
        {
            var publishers = _publisherService.GetAll(true);

            return(View(Mapper.Map <IEnumerable <PublisherViewModel> >(publishers)));
        }