public ActionResult Detay(int id) { MovieDBEntities1 db = new MovieDBEntities1(); var list = db.Movies.ToList(); DetayModel detayModel = new DetayModel(); Movies movie = list.Find(x => x.Id == id); detayModel.movie = movie; detayModel.comments = detayModel.movie.Comments.OrderByDescending(x => x.Id).ToList(); return(View(detayModel)); }
public ActionResult Detay(DetayModel detayModel) { Repository <Movies> movies = new Repository <Movies>(); Repository <Comments> comments = new Repository <Comments>(); Comments comment = new Comments(); var list = movies.List(); comment.OwnerId = CurrentSession.User.Id; comment.Text = detayModel.eklenen_Yorum; comment.MovieId = detayModel.movieId; comments.Insert(comment); return(RedirectToAction("Detay/" + detayModel.movieId)); }