Beispiel #1
0
        public IActionResult MovieView(int id)
        {
            MovieComments          mc  = new MovieComments();
            Movie                  mv  = ctx.Movies.FirstOrDefault(i => i.MovieId == id);
            IEnumerable <Comment>  cm  = ctx.Comments.Where(i => i.MovieId == id);
            IEnumerable <Category> cat = ctx.MovieCategories.Where(i => i.MovieId == id).Select(i => i.category).ToList();

            mc.movie      = mv;
            mc.comments   = cm;
            mc.categories = cat;

            return(View(mc));
        }
Beispiel #2
0
        public IActionResult MovieView(string dname, string dsurname, string demail, string comment, int id)
        {
            MovieComments mc = new MovieComments();


            Comment cm = new Comment();

            cm.Name     = dname;
            cm.Surname  = dsurname;
            cm.Email    = demail;
            cm.Comments = comment;
            cm.MovieId  = id;

            ctx.Comments.Add(cm);
            ctx.SaveChanges();

            mc.comments   = ctx.Comments.Where(i => i.MovieId == id);
            mc.movie      = ctx.Movies.FirstOrDefault(i => i.MovieId == id);
            mc.categories = ctx.MovieCategories.Where(i => i.MovieId == id).Select(i => i.category).ToList();

            return(View(mc));
        }