public ActionResult Index(int actorid = 0)
        {
            if (actorid == 0)
            {
                return(RedirectToAction("Index", "actor", "Index"));
            }

            ViewBag.ActorID = actorid;

            var WCF           = new ServiceWCFMovies.Service1Client();
            var CommentsModel = new List <Comment>();
            ICollection <CommentDTO> CommentsDTO = new List <CommentDTO>();


            CommentsDTO = WCF.GetCommentByActorId(actorid);
            if (CommentsDTO != null)
            {
                foreach (CommentDTO c in CommentsDTO)
                {
                    string image_path = ("/Rate_Stars/" + c.Rate + ".png");
                    CommentsModel.Add(new Comment(c.Content, c.Avatar, c.Date, image_path));
                }
            }
            else
            {
                return(RedirectToAction("Index", "actor", "Index"));
            }


            return(View(CommentsModel));
        }
        public ActionResult Index(int Input_ActorID, string Input_Avatar, string Input_Contenu, int Input_note)
        {
            ViewBag.ActorID = Input_ActorID;
            var WCF = new ServiceWCFMovies.Service1Client();

            if (WCF.InsertCommentOnActorId(Input_ActorID, new CommentDTO(Input_Contenu, Input_note, Input_Avatar)) == false)
            {
                return(RedirectToAction("Index", "actor", "Index"));
            }


            var CommentsModel = new List <Comment>();
            ICollection <CommentDTO> CommentsDTO = new List <CommentDTO>();

            CommentsDTO = WCF.GetCommentByActorId(Input_ActorID);
            if (CommentsDTO != null)
            {
                foreach (CommentDTO c in CommentsDTO)
                {
                    string image_path = ("/Rate_Stars/" + c.Rate + ".png");
                    CommentsModel.Add(new Comment(c.Content, c.Avatar, c.Date, image_path));
                }
            }


            return(View(CommentsModel));
        }
Beispiel #3
0
        // GET: actor
        public ActionResult Index(string chgm_page = null, int page_en_cours = 1)
        {
            var WCF         = new ServiceWCFMovies.Service1Client();
            var ActorsModel = new List <Actor>();
            ICollection <ActorDTO> ActorsDTO = new List <ActorDTO>();

            int nombre_de_page = WCF.GetCountActors() / 10;

            if (page_en_cours < 1 || page_en_cours > nombre_de_page)
            {
                return(RedirectToAction("Index", "actor", "Index"));
            }

            if (chgm_page == "precedent")
            {
                if (page_en_cours > 1)
                {
                    page_en_cours--;
                }
            }
            if (chgm_page == "suivant")
            {
                if (page_en_cours < nombre_de_page)
                {
                    page_en_cours++;
                }
            }

            ViewBag.page_en_cours = page_en_cours;

            ActorsDTO          = WCF.GetXActorsFromY(10, (page_en_cours - 1) * 10);
            ViewBag.Pagination = (page_en_cours + "/" + nombre_de_page);



            foreach (ActorDTO a in ActorsDTO)
            {
                string image_path = ("/Rate_Stars/" + WCF.getRateCommentbyActorID(a.ActorId) + ".png");
                ActorsModel.Add(new Actor(a.ActorId, a.Firstname, a.Name, image_path));
            }

            return(View(ActorsModel));
        }
        // GET: movie
        public ActionResult Index(int actorid = 0)
        {
			var WCF = new ServiceWCFMovies.Service1Client();
			var MoviesModel = new List<Movie>();
			ICollection<MovieDTO> MoviesDTO = new List<MovieDTO>();


			MoviesDTO = WCF.GetMovieByIdActor(actorid);
			if(MoviesDTO != null)
			{
				foreach (MovieDTO m in MoviesDTO)
				{
					MoviesModel.Add(new Movie(m.MovieID, m.Title, m.Runtime, m.Posterpath, m.ReleaseDate));
				}
			}
			else
			{
				return RedirectToAction("Index", "actor", "Index");
			}


			return View(MoviesModel);
		}