Exemple #1
0
        public BloggInfo GetBloggDetails(int id)
        {
            var blogg = new BloggInfo();

            using (BloggContext db = new BloggContext())
            {
                blogg = db.BloggInfo.FirstOrDefault(r => r.Id == id);
            }
            return(blogg);
        }
Exemple #2
0
 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();
     }
 }