public string updatePost(int PostID, string PostTitle, string PostText)
{
try
{
using (var ctx = new PostContext())
{
Post oldPost = ctx.Posts.Find(PostID);
if (oldPost != null)
{
oldPost.PostTitle = PostTitle;
oldPost.PostText = PostText;
ctx.SaveChanges();
}
}
return "ok";
}
catch (Exception)
{
return "fail";
}
}