public override void DeleteComment(int id) { var context = new BlogsEntities(); var obj = new tblBlogs_Comments {Id = id}; context.AttachTo("tblBlogs_Comments", obj); context.DeleteObject(obj); context.SaveChanges(); }
private static Comment Convert(tblBlogs_Comments obj) { if (obj == null) { return null; } var comment = new Comment(obj.Id, obj.CreatedDate, obj.CreatedBy, obj.ModifiedDate, obj.ModifiedBy); BizObject<Comment, int>.CopyFromObject(comment, obj); return comment; }
public override void UpdateComment(Comment comment) { var context = new BlogsEntities(); var obj = new tblBlogs_Comments {Id = comment.Id}; context.AttachTo("tblBlogs_Comments", obj); BizObject<Comment, int>.CopyToObject(comment, obj); context.SaveChanges(); }
public override int InsertComment(Comment comment) { var context = new BlogsEntities(); var obj = new tblBlogs_Comments(); BizObject<Comment, int>.CopyToObject(comment, obj); context.AddTotblBlogs_Comments(obj); context.SaveChanges(); return obj.Id; }