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

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

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