public void AddLinkpost(Linkpost linkpost) { using (var db = new Sova()) { linkpost.linkpostid = db.Linkpost.Max(lp => lp.linkpostid) + 1; db.Add(linkpost); db.SaveChanges(); } }
public void AddPost_tag(Post_tag pt) { using (var db = new Sova()) { pt.postid = db.Post_tag.Max(p => pt.id) + 1; db.Add(pt); db.SaveChanges(); } }
public void AddHistory(History history) { using (var db = new Sova()) { history.id = db.HistoryList.Max(h => h.id) + 1; db.Add(history); db.SaveChanges(); } }
public void AddUser(User user) { using (var db = new Sova()) { user.id = db.User.Max(u => u.id) + 1; db.Add(user); db.SaveChanges(); } }
public void AddComment(Comment comment) { using (var db = new Sova()) { comment.id = db.Comments.Max(c => c.id) + 1; db.Add(comment); db.SaveChanges(); } }
public void AddPost(Post post) { using (var db = new Sova()) { post.id = db.Posts.Max(p => p.id) + 1; db.Add(post); db.SaveChanges(); } }
public void AddTags(Tags tags) { using (var db = new Sova()) { tags.id = db.Tags.Max(ta => ta.id) + 1; db.Add(tags); db.SaveChanges(); } }
public bool DeletePost_tag(int id) { using (var db = new Sova()) { var post_tag = db.Post_tag.FirstOrDefault(pt => pt.id == id); if (post_tag == null) { return(false); } db.Remove(post_tag); return(db.SaveChanges() > 0); } }
public bool DeleteLinkpost(int id) { using (var db = new Sova()) { var linkpost = db.Linkpost.FirstOrDefault(lp => lp.linkpostid == id); if (linkpost == null) { return(false); } db.Remove(linkpost); return(db.SaveChanges() > 0); } }
public bool DeleteUser(int id) { using (var db = new Sova()) { var user = db.User.FirstOrDefault(u => u.id == id); if (user == null) { return(false); } db.Remove(user); return(db.SaveChanges() > 0); } }
public bool DeleteComment(int id) { using (var db = new Sova()) { var comment = db.Comments.FirstOrDefault(c => c.id == id); if (comment == null) { return(false); } db.Remove(comment); return(db.SaveChanges() > 0); } }
public bool DeleteTags(int id) { using (var db = new Sova()) { var tags = db.Tags.FirstOrDefault(ta => ta.id == id); if (tags == null) { return(false); } db.Remove(tags); return(db.SaveChanges() > 0); } }
public bool UpdatePost_tag(Post_tag post_tag) { using (var db = new Sova()) try { db.Attach(post_tag); db.Entry(post_tag).State = EntityState.Modified; return(db.SaveChanges() > 0); } catch (DbUpdateConcurrencyException) { return(false); } }
public bool UpdateLinkpost(Linkpost linkpost) { using (var db = new Sova()) try { db.Attach(linkpost); db.Entry(linkpost).State = EntityState.Modified; return(db.SaveChanges() > 0); } catch (DbUpdateConcurrencyException) { return(false); } }
public bool UpdateUser(User user) { using (var db = new Sova()) try { db.Attach(user); db.Entry(user).State = EntityState.Modified; return(db.SaveChanges() > 0); } catch (DbUpdateConcurrencyException) { return(false); } }