public RedirectToActionResult AddCommentToActivity(string text, string id) { var comment = new CommentsToActivities { Text = text, DateTime = DateTime.Now, UserProfile = _databaseService.GetCurrentUserProfile(User), Activities = _databaseService.GetActivitiesById(int.Parse(id)) }; _databaseService.AddCommentToActivity(comment); return(RedirectToAction("Index")); }
public void AddCommentToActivity(CommentsToActivities comment) { _db.CommentsToActivities.Add(comment); _db.SaveChanges(); }