public IHttpActionResult CreateFeedDiscussion([FromBody] FeedDiscussion feedDis) { FeedDiscussionRepository db = new FeedDiscussionRepository(); db.CreateFeedDiscussion(feedDis); return(Ok()); }
public IHttpActionResult CreateFeedDiscussion(Guid FeedId, string CommentText) { if (FeedId.Equals(Guid.Empty) || CommentText == "" || CommentText == null) { throw new Exception("Geen comment ingevuld"); } UserRepository UserRep = new UserRepository(); FeedRepository FeedRep = new FeedRepository(); FeedDiscussionRepository FeedDisRep = new FeedDiscussionRepository(); FeedDiscussion Comment = new FeedDiscussion() { Id = Guid.NewGuid(), CreatedAt = DateTime.Now, Text = CommentText, User_Id = UserRep.GetUserByEmail(User.Identity.Name).Id, Feed_Id = FeedId }; FeedDisRep.CreateFeedDiscussion(Comment); return(Ok()); }
public void CreateFeedDiscussion(FeedDiscussion feedDis) { db.FeedDiscussions.Add(feedDis); db.SaveChanges(); }