public Blogs GetBlog(int id) { List <Blogs> test = _context.Blogs.Where(t => t.Id == id).ToList(); Blogs q = test.First(); return(_context.Blogs.Where(b => b.Id == id).First()); }
public void AddBlogs(string Title, string Summary, string Content, DateTime PublishedDateTime, int UserID) { Blogs newBlog = new Blogs { Title = Title, Summary = Summary, Content = Content, PublishedDateTime = PublishedDateTime, UserID = UserID }; _context.Blogs.Add(newBlog); _context.SaveChanges(); }
public void AddBlogs(Blogs b) { _context.Blogs.Add(b); _context.SaveChanges(); }