public int CreateBlogEntry(BlogEntry blogEntry) { base.EbalitDBContext.BlogEntries.Add(blogEntry); base.EbalitDBContext.SaveChanges(); return blogEntry.Id; }
public void DeleteBlogEntry(BlogEntry blogEntry) { base.EbalitDBContext.BlogEntries.Attach(blogEntry); base.EbalitDBContext.BlogEntries.Remove(blogEntry); base.EbalitDBContext.SaveChanges(); }
public void UpdateBlogEntry(BlogEntry blogEntry) { var originalRecord = base.EbalitDBContext.BlogEntries.Find(blogEntry.Id); if (originalRecord != null) { base.EbalitDBContext.Entry(originalRecord).CurrentValues.SetValues(blogEntry); base.EbalitDBContext.SaveChanges(); } }