Example #1
0
        public Post EditPost(Post post)
        {
            db.Entry(post).State = EntityState.Modified;
            db.SaveChanges();

            return post;
        }
Example #2
0
        public int CreatePost(Post post)
        {
            db.Posts.Add(post);
            db.SaveChanges();

            return post.PostId;
        }
Example #3
0
 public Post EditPost(Post post)
 {
     try
     {
         var result = repo.EditPost(post);
         return result;
     }
     catch (Exception ex)
     {
         return null;
     }
 }
Example #4
0
 public int CreatePost(Post post)
 {
     try
     {
         int result = repo.CreatePost(post);
         return result;
     }
     catch (Exception ex)
     {
         return 0;
     }
 }