public ActionResult addComment(AddCommentToPersonModel newComment) { comment temp = new comment(); temp.date = DateTime.Now; temp.person_id = newComment.personId; temp.user_id = newComment.userId; temp.text = newComment.comment; dbPerson.addCommentToPerson(temp); return View(); }
public bool addCommentToPerson(comment temp) { try { db.comments.Add(temp); db.SaveChanges(); return true; } catch { db.comments.Remove(temp); return false; } }
public ActionResult addComment(AddCommentToMovieModel newComment) { comment temp = new comment(); temp.date = DateTime.Now; temp.movie_id = newComment.movieId; temp.user_id = dbUser.getIdbyName(newComment.userName); temp.text = newComment.comment; dbMovie.addCommentToMovie(temp); return RedirectToAction("Show", "Movie", new{ id =1 }); }