Exemplo n.º 1
0
        public async Task <IActionResult> Insert()
        {
            var directors = await _directorService.GetAll();

            var casts = await _castService.GetAll();

            var scenarists = await _scenaristService.GetAll();

            var genres = await _genreService.GetAll();

            var languages = await _langugageService.GetAll();

            if (directors.ResultStatus == ResultStatus.Success &&
                casts.ResultStatus == ResultStatus.Success &&
                scenarists.ResultStatus == ResultStatus.Success)
            {
                ViewBag.Directors  = directors.Data;
                ViewBag.Casts      = casts.Data;
                ViewBag.Scenarists = scenarists.Data;
                ViewBag.Genres     = genres.Data;
                ViewBag.Languages  = languages.Data;
            }
            else
            {
                ViewBag.Directors  = null;
                ViewBag.Casts      = null;
                ViewBag.Scenarists = null;
                ViewBag.Genres     = null;
                ViewBag.Languages  = null;
            }
            return(View());
        }
        public async Task <IActionResult> Index()
        {
            var scenarists = await _scenaristService.GetAll();

            if (scenarists.ResultStatus == ResultStatus.Success)
            {
                return(View(scenarists.Data));
            }

            return(View(null));
        }