public string createPost(string PostTitle, string PostText)
        {
            try
            {
                using (var ctx = new PostContext())
                {
                    //if (!ctx.Database.Exists())
                    //{
                    //    ((IObjectContextAdapter)ctx).ObjectContext.CreateDatabase();
                    //}
                    Post post = new Post()
                    {

                        PostTitle = PostTitle,
                        PostText = PostText,
                        PostDate = DateTime.Now,
                        PostDeletedDate = null
                    };

                    ctx.Posts.Add(post);
                    ctx.SaveChanges();
                }
                return "ok";
            }
            catch (Exception)
            {
                return "fail";
            }
        }
 public string deletePost(int PostID)
 {
     try
     {
         using (var ctx = new PostContext())
         {
             Post oldPost = ctx.Posts.Find(PostID);
             if (oldPost != null)
             {
                 if(oldPost.PostDeletedDate != null)
                 {
                     return "already deleted";
                 }
                 else
                 {
                     oldPost.PostDeletedDate = DateTime.Now;
                     ctx.SaveChanges();
                 }
             }
         }
         return "ok";
     }
     catch (Exception)
     {
         return "fail";
     }
 }
 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";
     }
 }