Esempio n. 1
0
        public bool AddPost(PostDTO model)
        {
            Post post = new Post();

            post.Title            = model.Title;
            post.ShortContent     = model.ShortContent;
            post.PostContent      = model.PostContent;
            post.Slider           = model.Slider;
            post.Area1            = model.Area1;
            post.Area2            = model.Area2;
            post.Area3            = model.Area3;
            post.Notification     = model.Notification;
            post.CategoryID       = model.CategoryID;
            post.SeoLink          = SeoLink.GenerateUrl(model.Title);
            post.LanguageName     = model.Language;
            post.AddDate          = DateTime.Now;
            post.AddUserID        = UserStatic.UserID;
            post.LastUpdateDate   = DateTime.Now;
            post.LastUpdateUserID = UserStatic.UserID;
            int ID = dao.AddPost(post);

            LogDAO.AddLog(General.ProcessType.PostAdd, General.TableName.Post, ID);
            SavePostImages(model.PostImages, ID);
            AddTags(model.TagText, ID);
            return(true);
        }
Esempio n. 2
0
        public GeneralDTO GetCategoryPostList(string categoryName)
        {
            GeneralDTO dto = new GeneralDTO();

            dto.BreakingPost = dao.GetBreakingPosts();
            dto.Adslist      = adsdao.GetAdsList();
            if (categoryName == "video")
            {
                dto.Videos       = dao.GetAllVideos();
                dto.CategoryName = "video";
            }
            else
            {
                List <CategoryDTO> categorylist = categorydao.GetCategoryList();
                int categoryID = 0;
                foreach (var item in categorylist)
                {
                    if (categoryName == SeoLink.GenerateUrl(item.CategoryName))
                    {
                        categoryID       = item.ID;
                        dto.CategoryName = item.CategoryName;
                        break;
                    }
                }
                dto.CategoryPostList = dao.GetCategoryPostList(categoryID);
            }

            return(dto);
        }
Esempio n. 3
0
 public bool UpdatePost(PostDTO model)
 {
     model.SeoLink = SeoLink.GenerateUrl(model.Title);
     dao.UpdatePost(model);
     LogDAO.AddLog(General.ProcessType.PostUpdate, General.TableName.Post, model.ID);
     if (model.PostImages != null)
     {
         SavePostImages(model.PostImages, model.ID);
     }
     dao.DeleteTags(model.ID);
     AddTags(model.TagText, model.ID);
     return(true);
 }