public BloggInfo GetBloggDetails(int id) { var blogg = new BloggInfo(); using (BloggContext db = new BloggContext()) { blogg = db.BloggInfo.FirstOrDefault(r => r.Id == id); } return(blogg); }
public void CreateNewBlogg(BloggInfo model) { using (BloggContext db = new BloggContext()) { var blogg = new BloggInfo() { CategoryId = model.CategoryId, Date = DateTime.Now, BloggInput = model.BloggInput, Heading = model.Heading }; db.BloggInfo.Add(blogg); db.SaveChanges(); } }