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());
        }
Beispiel #2
0
        public async Task <IActionResult> Index()
        {
            var directors = await _directorService.GetAll();

            if (directors.ResultStatus == ResultStatus.Success)
            {
                return(View(directors.Data));
            }
            return(View(null));
        }
Beispiel #3
0
        public ManagerDirectorsController(IDirectorService directorService)
        {
            _directorService = directorService;

            var directors = _directorService.GetAll();

            if (directors != null)
            {
                var directorViewModels = Mapper.Map <IEnumerable <DirectorViewModel> >(directors);

                _listDirectorViewModel = directorViewModels.ToList();
            }
        }
        public IActionResult GetAll()
        {
            var response = _service.GetAll();

            return(Ok(response));
        }
Beispiel #5
0
 public async Task OnGetAsync()
 {
     directorInput = await _directorService.GetAll();
 }
Beispiel #6
0
 private void GetAllDirector()
 {
     dgvDirector.DataSource = _directorService.GetAll();
 }
Beispiel #7
0
        public ActionResult Edit(Guid id)
        {
            if (id == null)
            {
                return(RedirectToAction("Index"));
            }
            var film = _filmService.Find(id);

            if (film == null)
            {
                return(HttpNotFound());
            }
            var movie = _movieService.Find(film.MovieId);

            var movieViewModel = AutoMapper.Mapper.Map <MoviesViewModel>(movie);
            var filmViewModel  = AutoMapper.Mapper.Map <FilmViewModel>(film);

            //Director Start
            var listDirectorMovie  = _directorMovieService.GetIdDirectorByMovieId(movie.Id);
            var listDirector       = _directorService.GetAll();
            var listDirectorSelect = new List <SelectListItem>();

            foreach (var item in listDirector)
            {
                if (listDirectorMovie.Contains(item.Id))
                {
                    listDirectorSelect.Add(new SelectListItem()
                    {
                        Value    = item.Id.ToString(),
                        Text     = item.NameDirector,
                        Selected = true
                    });
                }
                else
                {
                    listDirectorSelect.Add(new SelectListItem()
                    {
                        Value    = item.Id.ToString(),
                        Text     = item.NameDirector,
                        Selected = false
                    });
                }
            }
            //Director End

            //Actor Start
            var listActorMovie  = _actorMovieService.GetIdActorByMovieId(movie.Id);
            var listActor       = _actorService.GetAll();
            var listActorSelect = new List <SelectListItem>();

            foreach (var item in listActor)
            {
                if (listActorMovie.Contains(item.Id))
                {
                    listActorSelect.Add(new SelectListItem()
                    {
                        Value    = item.Id.ToString(),
                        Text     = item.NameActor,
                        Selected = true
                    });
                }
                else
                {
                    listActorSelect.Add(new SelectListItem()
                    {
                        Value    = item.Id.ToString(),
                        Text     = item.NameActor,
                        Selected = false
                    });
                }
            }
            //Actor End

            //Producer Start
            var listProducerMovie  = _producerMovieService.GetIdProducerByMovieId(movie.Id);
            var listProducer       = _producerService.GetAll();
            var listProducerSelect = new List <SelectListItem>();

            foreach (var item in listProducer)
            {
                if (listProducerMovie.Contains(item.Id))
                {
                    listProducerSelect.Add(new SelectListItem()
                    {
                        Value    = item.Id.ToString(),
                        Text     = item.NameProducer,
                        Selected = true
                    });
                }
                else
                {
                    listProducerSelect.Add(new SelectListItem()
                    {
                        Value    = item.Id.ToString(),
                        Text     = item.NameProducer,
                        Selected = false
                    });
                }
            }
            //Producer End

            //Category Start
            var listCategoryMovie  = _categoryMovieService.GetIdCategoryByMovieId(movie.Id);
            var listCategory       = _categorysService.GetAll();
            var listCategorySelect = new List <SelectListItem>();

            foreach (var item in listCategory)
            {
                if (listCategoryMovie.Contains(item.Id))
                {
                    listCategorySelect.Add(new SelectListItem()
                    {
                        Value    = item.Id.ToString(),
                        Text     = item.NameCategory,
                        Selected = true
                    });
                }
                else
                {
                    listCategorySelect.Add(new SelectListItem()
                    {
                        Value    = item.Id.ToString(),
                        Text     = item.NameCategory,
                        Selected = false
                    });
                }
            }
            //Category End

            //Resolution Start
            var listResolutionMovie  = _resolutionMovieService.GetIdResolutionByMovieId(movie.Id);
            var listResolution       = _resolutionService.GetAll();
            var listResolutionSelect = new List <SelectListItem>();

            foreach (var item in listResolution)
            {
                if (listResolutionMovie.Contains(item.Id))
                {
                    listResolutionSelect.Add(new SelectListItem()
                    {
                        Value    = item.Id.ToString(),
                        Text     = item.NameResolution,
                        Selected = true
                    });
                }
                else
                {
                    listResolutionSelect.Add(new SelectListItem()
                    {
                        Value    = item.Id.ToString(),
                        Text     = item.NameResolution,
                        Selected = false
                    });
                }
            }
            //Resolution End

            //Tag Start
            var listTagMovie  = _tagMovieService.GetIdTagByMovieId(movie.Id);
            var listTag       = _tagService.GetAll();
            var listTagSelect = new List <SelectListItem>();

            foreach (var item in listTag)
            {
                if (listResolutionMovie.Contains(item.Id))
                {
                    listTagSelect.Add(new SelectListItem()
                    {
                        Value    = item.Id.ToString(),
                        Text     = item.NameTag,
                        Selected = true
                    });
                }
                else
                {
                    listTagSelect.Add(new SelectListItem()
                    {
                        Value    = item.Id.ToString(),
                        Text     = item.NameTag,
                        Selected = false
                    });
                }
            }
            //Tag End


            ViewBag.ListDirector   = listDirectorSelect;
            ViewBag.ListActor      = listActorSelect;
            ViewBag.ListProducer   = listProducerSelect;
            ViewBag.ListCategory   = listCategorySelect;
            ViewBag.ListResolution = listResolutionSelect;
            ViewBag.ListTag        = listTagSelect;


            var model = new FeatureFilmViewModel()
            {
                MoviesViewModel = movieViewModel,
                FilmViewModel   = filmViewModel
            };

            return(View("_Edit", model));
        }
        public IEnumerable <Director> GetAll()

        {
            return(_directorService.GetAll());
        }
Beispiel #9
0
 void GetAllDirector()
 {
     cmbDirector.DataSource    = _directorService.GetAll();
     cmbDirector.DisplayMember = "Name" + "SurName";
     cmbDirector.ValueMember   = "ID";
 }