public string createComment(string Comment, int PostID)
{
try
{
using (var ctx = new CommentContext())
{
Comment comment = new Comment()
{
CommentText = Comment,
PostID = PostID,
CommentDate = new DateTime()
};
ctx.Comments.Add(comment);
ctx.SaveChanges();
}
return "ok";
}
catch (Exception)
{
return "fail";
}
}