Exemplo n.º 1
0
        public ActionResult Edit(int id)
        {
            GenreSinglePageViewModel model = new GenreSinglePageViewModel();

            model.GenreViewModel = _genreService.GetGenreById(id).ConvertToViewModel();
            return(View(model));
        }
Exemplo n.º 2
0
        public ActionResult Create()
        {
            GenreSinglePageViewModel model = new GenreSinglePageViewModel();

            model.GenreViewModel = new GenreViewModel();
            model.Success        = true;
            return(View(model));
        }
Exemplo n.º 3
0
        public ActionResult Edit(GenreSinglePageViewModel model)
        {
            if (ModelState.IsValid)
            {
                _genreService.UpdateGenre(model.GenreViewModel.ConvertToModel());
                return(RedirectToAction("Index"));
            }

            return(View(model));
        }
Exemplo n.º 4
0
        public ActionResult Create(GenreSinglePageViewModel model)
        {
            CreateGenreRequest  request  = model.GenreViewModel.ConvertToCreateGenreRequest();
            CreateGenreResponse response = _genreService.CreateGenre(request);

            if (response.Success)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                model.Success = false;
                model.Message = response.Message;
                return(View(model));
            }
        }
Exemplo n.º 5
0
        public ActionResult Details(int id)
        {
            GenreSinglePageViewModel model    = new GenreSinglePageViewModel();
            FindAllGenresResponse    response = _genreService.FindAllGenres();

            if (response.Success)
            {
                model.GenreViewModel = response.Genres.Where(x => x.GenreId == id).First().ConvertToGenreViewModel();
                model.Success        = true;
            }
            else
            {
                model.Message = response.Message;
                model.Success = false;
            }
            return(View(model));
        }