Exemplo n.º 1
0
        public ActionResult Search(ArtistsSearchViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var genres = _service.GetAllGenres();

            model.Genres = genres;

            if (!string.IsNullOrEmpty(model.Name) || !string.IsNullOrEmpty(model.Genre))
            {
                var artists = _service.GetArtists(model.Name, model.Genre);
                model.Artists  = artists;
                model.IsSearch = true;
            }

            return(View(model));
        }