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());
        }
示例#2
0
        public async Task <IActionResult> Index()
        {
            var casts = await _castService.GetAll();

            if (casts.ResultStatus == ResultStatus.Success)
            {
                return(View(casts.Data));
            }
            return(View(null));
        }
示例#3
0
        // GET: Casts
        public ActionResult Index()
        {
            var casts = Mapper.Map <IEnumerable <CastViewModel> >(castService.GetAll());

            return(View(casts));
        }