Esempio n. 1
0
 public BlogEntity createBlog(BlogEntity blogEntity)
 {
     try
     {
         blog blogObj = Decorator.getBlog(blogEntity);
         blogObj.CreateDate = DateTime.Now;
         blogObj.IsPublished = false;
         db.blogs.Add(blogObj);
         db.SaveChanges();
         BlogKeywords blogKeywordsObj = new BlogKeywords();
         BlogKeywordsEntity blogKeywords = new BlogKeywordsEntity();
         blogKeywords.Page_Id = blogObj.Id;
         blogKeywords.Page_Type = blogObj.Name;
         blogKeywords.Page_Keywords = blogEntity.Page_Keywords;
         blogKeywords.Page_Description = blogEntity.Page_Description;
         blogKeywords.IsDeleted = false;
         blogKeywordsObj.createBlogKeywords(blogKeywords);
         return Decorator.getBlogEntity(blogObj);
     }
     catch (Exception ex)
     {
         ApplicationLog.WriteTrace(ex);
         return null;
     }
 }
 public BlogKeywordsEntity Add(BlogKeywordsEntity item)
 {
     if (item == null)
     {
         throw new ArgumentNullException("item");
     }
     return blogKeywordsObject.createBlogKeywords(item);
 }
 public void editBlogKeywords(BlogKeywordsEntity blogKeywordsEntity)
 {
     blog_keywords blogKeywordsObj = db.blog_keywords.Find(blogKeywordsEntity.Id);
     blogKeywordsObj.Page_Description = blogKeywordsEntity.Page_Description;
     blogKeywordsObj.Page_Keywords = blogKeywordsEntity.Page_Keywords;
     blogKeywordsObj.Keyword_UpdatedDate = DateTime.Now;
     db.Entry(blogKeywordsObj).State = EntityState.Modified;
     db.SaveChanges();
 }
 public BlogKeywordsEntity createBlogKeywords(BlogKeywordsEntity blogKeywordsEntity)
 {
     blog_keywords blogKeywordsObj = Decorator.getBlogKeywords(blogKeywordsEntity);
     blogKeywordsObj.Keyword_CreatedDate = DateTime.Now;
     blogKeywordsObj.Keyword_UpdatedDate = DateTime.Now;
     db.blog_keywords.Add(blogKeywordsObj);
     db.SaveChanges();
     return Decorator.getBlogKeywordsEntity(blogKeywordsObj);
 }
 public BlogKeywordsEntity getBlogKeywordsListByBlogTitle(string blogTitle="Homepage")
 {
     BlogKeywordsEntity blogKeywordsEntity = new BlogKeywordsEntity();
     var blogKeywords = db.blog_keywords.Where(bk => bk.Page_Type == blogTitle && bk.IsDeleted == false).ToList();
     if (blogKeywords != null && blogKeywords.Count > 0)
     {
         blogKeywordsEntity = Decorator.getBlogKeywordsEntity(blogKeywords[0]);
     }
     return blogKeywordsEntity;
 }
 public BlogKeywordsEntity getBlogKeywordsListByBlogId(int blogId=0)
 {
     BlogKeywordsEntity blogKeywordsEntity = new BlogKeywordsEntity();
     var blogKeywords = db.blog_keywords.Where(bk => bk.Page_Id == blogId && bk.IsDeleted == false).ToList();
     if (blogKeywords != null && blogKeywords.Count > 0)
     {
         blogKeywordsEntity= Decorator.getBlogKeywordsEntity(blogKeywords[0]);
     }
     return blogKeywordsEntity;
 }
        public bool Update(BlogKeywordsEntity item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            // TO DO : Code to update record into database
            blogKeywordsObject.editBlogKeywords(item);
            return true;
        }
 public static blog_keywords getBlogKeywords(BlogKeywordsEntity blogKeywordsEntityObj)
 {
     blog_keywords blogKeywords = new blog_keywords();
     blogKeywords.Id = blogKeywordsEntityObj.Id;
     blogKeywords.Page_Type = HttpUtility.HtmlEncode(blogKeywordsEntityObj.Page_Type);
     blogKeywords.Page_Id = blogKeywordsEntityObj.Page_Id;
     blogKeywords.Keyword_CreatedDate = blogKeywordsEntityObj.Keyword_CreatedDate;
     blogKeywords.Keyword_UpdatedDate = blogKeywordsEntityObj.Keyword_UpdatedDate;
     blogKeywords.Page_Keywords = HttpUtility.HtmlEncode(blogKeywordsEntityObj.Page_Keywords);
     blogKeywords.Page_Description = HttpUtility.HtmlEncode(blogKeywordsEntityObj.Page_Description);
     blogKeywords.IsDeleted = blogKeywordsEntityObj.IsDeleted;
     return blogKeywords;
 }
 public void editBlogKeywords(BlogKeywordsEntity blogKeywordsEntity)
 {
     blogsKeywordsObj.editBlogKeywords(blogKeywordsEntity);
 }
 public BlogKeywordsEntity createBlogKeywords(BlogKeywordsEntity blogKeywordsEntity)
 {
     return blogsKeywordsObj.createBlogKeywords(blogKeywordsEntity);
 }