public Post EditPost(Post post) { db.Entry(post).State = EntityState.Modified; db.SaveChanges(); return post; }
public int CreatePost(Post post) { db.Posts.Add(post); db.SaveChanges(); return post.PostId; }
public Post EditPost(Post post) { try { var result = repo.EditPost(post); return result; } catch (Exception ex) { return null; } }
public int CreatePost(Post post) { try { int result = repo.CreatePost(post); return result; } catch (Exception ex) { return 0; } }