Exemplo n.º 1
0
 public BlogController(NccPostService nccPostService, NccUserService nccUserService, ILoggerFactory loggerFactory)
 {
     _nccPostService = nccPostService;
     _loggerFactory  = loggerFactory;
     _nccUserService = nccUserService;
     _logger         = _loggerFactory.CreateLogger <BlogController>();
 }
Exemplo n.º 2
0
 public PostShortCode(NccPostService nccPostService) : base(
         typeof(BlogController),
         "Post",
         "ShortCodes/PostRender")
 {
     _nccPostService = nccPostService;
 }
Exemplo n.º 3
0
 public TagsController(NccTagService nccTagService, NccPostService nccPostService, NccUserService nccUserService, ILoggerFactory loggerFactory)
 {
     _nccTagService  = nccTagService;
     _nccPostService = nccPostService;
     _nccUserService = nccUserService;
     _loggerFactory  = loggerFactory;
     _logger         = _loggerFactory.CreateLogger <CategoryController>();
 }
 public CommentsAuthorController(NccCommentsService nccCommentsService, NccPostService postService, NccUserService nccUserService, ILoggerFactory loggerFactory, UserManager <NccUser> UserManager)
 {
     _nccCommentsService = nccCommentsService;
     _postService        = postService;
     _loggerFactory      = loggerFactory;
     _nccUserService     = nccUserService;
     _userManager        = UserManager;
     _logger             = _loggerFactory.CreateLogger <BlogController>();
 }
Exemplo n.º 5
0
 public CategoryController(NccCategoryService nccCategoryService, NccCategoryDetailsService nccCategoryDetailsService, NccPostService nccPostService, INccUserService nccUserService, ILoggerFactory loggerFactory, IMemoryCache memoryCache)
 {
     _nccCategoryService        = nccCategoryService;
     _nccCategoryDetailsService = nccCategoryDetailsService;
     _nccPostService            = nccPostService;
     _loggerFactory             = loggerFactory;
     _cache          = memoryCache;
     _nccUserService = nccUserService;
     _logger         = _loggerFactory.CreateLogger <CategoryController>();
 }
Exemplo n.º 6
0
 public RecentPostWidget(NccPostService nccPostService) : base(
         typeof(BlogController),
         "Recent Post",
         "This is a widget to display recent blog posts.",
         "",
         "Widgets/RecentPost",
         "Widgets/RecentPostConfig",
         true)
 {
     _nccPostService = nccPostService;
 }
Exemplo n.º 7
0
 public PostController(NccPostService nccPostService, NccPostDetailsService nccPostDetailsService, NccCategoryService nccCategoryService, NccTagService nccTagService, NccShortCodeProvider nccShortCodeProvider, IMediator mediator, ILoggerFactory loggerFactory)
 {
     _nccPostService        = nccPostService;
     _nccPostDetailsService = nccPostDetailsService;
     _nccCategoryService    = nccCategoryService;
     _nccTagService         = nccTagService;
     _nccShortCodeProvider  = nccShortCodeProvider;
     _loggerFactory         = loggerFactory;
     _mediator = mediator;
     _logger   = _loggerFactory.CreateLogger <BlogController>();
 }
Exemplo n.º 8
0
 public ArchiveWidget(NccPostService nccPostService) : base(
         typeof(BlogController),
         "Archive",
         "This is a widget to display archive.",
         "",
         "Widgets/Archive",
         "Widgets/ArchiveConfig",
         true
         )
 {
     _nccPostService = nccPostService;
 }
Exemplo n.º 9
0
 public BlogPostSliderWidget(NccCategoryService nccCategoryService, NccPostService nccPostService) : base(
         typeof(BlogController),
         "Blog Post Slider",
         "This is a widget to display blog posts in slider.",
         "",
         "Widgets/BlogPostSlider",
         "Widgets/BlogPostSliderConfig",
         false)
 {
     _nccCategoryService = nccCategoryService;
     _nccPostService     = nccPostService;
 }
Exemplo n.º 10
0
 public AdminController(
     NccWebSiteService nccWebSiteService,
     NccPageService pageService,
     NccPostService postService,
     NccCategoryService categoryService,
     ILoggerFactory loggarFactory)
 {
     _webSiteService  = nccWebSiteService;
     _pageService     = pageService;
     _postService     = postService;
     _categoryService = categoryService;
     _logger          = loggarFactory.CreateLogger <AdminController>();
 }
Exemplo n.º 11
0
 public RecentPostWidget(
     IViewRenderService viewRenderService,
     NccWebSiteWidgetService websiteWidgetService,
     NccPostService nccPostService) : base(
         "Recent Post",
         "This is a widget to display recent blog posts.",
         "",
         true
         )
 {
     _viewRenderService    = viewRenderService;
     _websiteWidgetService = websiteWidgetService;
     _nccPostService       = nccPostService;
 }
Exemplo n.º 12
0
        public DemoDataHomeController(ILoggerFactory factory, RoleManager <NccRole> roleManager, UserManager <NccUser> userManager, NccPageService pageService, NccCategoryService categoryService, NccTagService tagService, NccPostService postService, NccCommentsService commentsService, NccPermissionService nccPermissionService)
        {
            _logger               = factory.CreateLogger <DemoDataHomeController>();
            _roleManager          = roleManager;
            _userManager          = userManager;
            _nccPermissionService = nccPermissionService;

            _pageService = pageService;

            _categoryService = categoryService;
            _tagService      = tagService;
            _postService     = postService;
            _commentsService = commentsService;
        }
Exemplo n.º 13
0
 public ArchiveWidget(
     IViewRenderService viewRenderService,
     NccWebSiteWidgetService websiteWidgetService,
     NccPostService nccPostService) : base(
         "Archive",
         "This is a widget to display archive.",
         "",
         true
         )
 {
     _viewRenderService    = viewRenderService;
     _websiteWidgetService = websiteWidgetService;
     _nccPostService       = nccPostService;
 }
Exemplo n.º 14
0
 public ArchiveWidget(
     IViewRenderService viewRenderService,
     NccWebSiteWidgetService websiteWidgetService,
     NccPostService nccPostService) : base(
         "NetCoreCMS.Core.Modules.Blog.Widgets.Archive",
         "Archive",
         "This is a widget to display archive.",
         "",
         true
         )
 {
     _viewRenderService    = viewRenderService;
     _websiteWidgetService = websiteWidgetService;
     _nccPostService       = nccPostService;
 }
Exemplo n.º 15
0
 public DashboardController(NccWebSiteService nccWebSiteService, NccPageService pageService, NccPostService postService, NccCategoryService categoryService, INccSettingsService settingsService, RoleManager <NccRole> roleManager, UserManager <NccUser> userManager, NccStartupService startupService, IConfiguration configuration, IHostingEnvironment hostingEnv,
                            NccModuleService moduleService, ILoggerFactory loggarFactory)
 {
     _webSiteService     = nccWebSiteService;
     _pageService        = pageService;
     _postService        = postService;
     _categoryService    = categoryService;
     _settingsService    = settingsService;
     _roleManager        = roleManager;
     _userManager        = userManager;
     _startupService     = startupService;
     _configuration      = configuration;
     _hostingEnvironment = hostingEnv;
     _moduleService      = moduleService;
     _logger             = loggarFactory.CreateLogger <AdminController>();
 }
Exemplo n.º 16
0
 public PostShortCode(NccPostService nccPostService, IViewRenderService viewRenderService)
 {
     _nccPostService    = nccPostService;
     _viewRenderService = viewRenderService;
 }
Exemplo n.º 17
0
        public static async Task SaveBasicData(NccUser nccUser, NccDbContext nccDbConetxt, UserManager <NccUser> userManager, RoleManager <NccRole> roleManager, NccSignInManager <NccUser> signInManager, WebSiteInfo setupInfo)
        {
            string enDemoTitle   = "";
            string enDemoSlug    = "";
            string enDemoContent = "";
            string bnDemoTitle   = "";
            string bnDemoSlug    = "";
            string bnDemoContent = "";

            //var webSiteRepository = new NccWebSiteRepository(nccDbConetxt);
            //var webSiteInfoRepository = new NccWebSiteInfoRepository(nccDbConetxt);
            //var webSiteService = new NccWebSiteService(webSiteRepository, webSiteInfoRepository);

            #region Create a sample page
            var nccPageRepository        = new NccPageRepository(nccDbConetxt);
            var nccPageDetailsRepository = new NccPageDetailsRepository(nccDbConetxt);
            var nccPageService           = new NccPageService(nccPageRepository, nccPageDetailsRepository);

            try
            {
                enDemoTitle   = "Sample Page ";
                enDemoSlug    = "Sample-Page";
                enDemoContent = "This is a sample page.";
                bnDemoTitle   = "নমুনা পৃষ্ঠা ";
                bnDemoSlug    = "নমুনা-পৃষ্ঠা";
                bnDemoContent = "এটি একটি নমুনা পাতা।";

                NccPage page = new NccPage();
                page.Metadata    = "DEMODATA";
                page.PublishDate = DateTime.Now;
                page.PageStatus  = NccPageStatus.Published;
                page.PageType    = NccPageType.Public;
                page.Layout      = "SiteLayout";
                page.CreateBy    = page.ModifyBy = 1;
                page.Name        = enDemoTitle;

                foreach (var item in SupportedCultures.Cultures)
                {
                    NccPageDetails _nccPageDetails = new NccPageDetails();
                    _nccPageDetails.Language = item.TwoLetterISOLanguageName;
                    if (item.TwoLetterISOLanguageName == "en")
                    {
                        _nccPageDetails.Title           = enDemoTitle;
                        _nccPageDetails.Slug            = enDemoSlug;
                        _nccPageDetails.Name            = enDemoSlug;
                        _nccPageDetails.Content         = "<h1 style=\"text-align:center\">" + enDemoTitle + "</h1><p>" + enDemoContent + "</p>";
                        _nccPageDetails.MetaDescription = enDemoTitle + " " + enDemoContent;
                    }
                    else if (item.TwoLetterISOLanguageName == "bn")
                    {
                        _nccPageDetails.Title           = bnDemoTitle;
                        _nccPageDetails.Slug            = bnDemoSlug;
                        _nccPageDetails.Name            = bnDemoSlug;
                        _nccPageDetails.Content         = "<h1 style=\"text-align:center\">" + bnDemoTitle + "</h1><p>" + bnDemoContent + "</p>";
                        _nccPageDetails.MetaDescription = bnDemoTitle + " " + bnDemoContent;
                    }
                    page.PageDetails.Add(_nccPageDetails);
                }
                nccPageService.Save(page);
            }
            catch (Exception ex)
            {
            }
            #endregion

            #region Create a sample category
            var categoryRepository = new NccCategoryRepository(nccDbConetxt);
            var categoryService    = new NccCategoryService(categoryRepository);

            try
            {
                enDemoTitle = "Sample Category ";
                enDemoSlug  = "Sample-Category";
                bnDemoTitle = "নমুনা ক্যাটাগরি ";
                bnDemoSlug  = "নমুনা-ক্যাটাগরি";
                NccCategory item = new NccCategory();
                item.Metadata      = "DEMODATA";
                item.Name          = enDemoTitle;
                item.CategoryImage = "/media/Images/2017/06/image-slider-0.jpg";
                foreach (var lang in SupportedCultures.Cultures)
                {
                    NccCategoryDetails _nccDetails = new NccCategoryDetails();
                    _nccDetails.Language = lang.TwoLetterISOLanguageName;
                    if (lang.TwoLetterISOLanguageName == "en")
                    {
                        _nccDetails.Title = enDemoTitle;
                        _nccDetails.Slug  = enDemoSlug;
                        _nccDetails.Name  = enDemoSlug;
                    }
                    else if (lang.TwoLetterISOLanguageName == "bn")
                    {
                        _nccDetails.Title = bnDemoTitle;
                        _nccDetails.Slug  = bnDemoSlug;
                        _nccDetails.Name  = bnDemoSlug;
                    }
                    item.CategoryDetails.Add(_nccDetails);
                }
                categoryService.Save(item);
            }
            catch (Exception ex) { }
            #endregion
            //var tagRepository = new NccTagRepository(nccDbConetxt);
            //var tagService = new NccTagService(tagRepository);

            #region Create a sample post
            var postRepository        = new NccPostRepository(nccDbConetxt);
            var postDetailsRepository = new NccPostDetailsRepository(nccDbConetxt);
            var postService           = new NccPostService(postRepository, postDetailsRepository);

            try
            {
                enDemoTitle   = "Sample Post ";
                enDemoSlug    = "Sample-Post";
                enDemoContent = "This is a sample post.";
                bnDemoTitle   = "নমুনা পোস্ট ";
                bnDemoSlug    = "নমুনা-পোস্ট";
                bnDemoContent = "এটি একটি নমুনা পোস্ট।";
                var categoryList = categoryService.LoadAll();

                NccPost post = new NccPost();
                post.Metadata     = "DEMODATA";
                post.PublishDate  = DateTime.Now;
                post.PostStatus   = NccPostStatus.Published;
                post.PostType     = NccPostType.Public;
                post.Layout       = "SiteLayout";
                post.CreateBy     = post.ModifyBy = 1;
                post.Name         = enDemoTitle;
                post.AllowComment = true;
                post.ThumImage    = "/media/Images/2017/06/image-slider-2.jpg";
                foreach (var postItem in SupportedCultures.Cultures)
                {
                    NccPostDetails _nccPostDetails = new NccPostDetails();
                    _nccPostDetails.Language = postItem.TwoLetterISOLanguageName;
                    if (postItem.TwoLetterISOLanguageName == "en")
                    {
                        _nccPostDetails.Title           = enDemoTitle;
                        _nccPostDetails.Slug            = enDemoSlug;
                        _nccPostDetails.Name            = enDemoSlug;
                        _nccPostDetails.Content         = "<h1 style=\"text-align:center\">" + enDemoTitle + "</h1><hr />" + enDemoContent;
                        _nccPostDetails.MetaDescription = enDemoTitle + " " + enDemoContent;
                    }
                    else if (postItem.TwoLetterISOLanguageName == "bn")
                    {
                        _nccPostDetails.Title           = bnDemoTitle;
                        _nccPostDetails.Slug            = bnDemoSlug;
                        _nccPostDetails.Name            = bnDemoSlug;
                        _nccPostDetails.Content         = "<h1 style=\"text-align:center\">" + bnDemoTitle + "</h1><hr />" + bnDemoContent;
                        _nccPostDetails.MetaDescription = bnDemoTitle + " " + bnDemoContent;
                    }
                    post.PostDetails.Add(_nccPostDetails);
                }
                postService.Save(post);

                try
                {
                    post            = postService.Get(post.Id, true);
                    post.Categories = new List <NccPostCategory>();
                    var temp = categoryList.FirstOrDefault();
                    if (temp != null)
                    {
                        if (post.Categories.Where(x => x.CategoryId == temp.Id).Count() <= 0)
                        {
                            post.Categories.Add(new NccPostCategory()
                            {
                                Post = post, CategoryId = temp.Id
                            });
                        }
                    }
                    postService.Update(post);
                }
                catch (Exception ex) { }
            }
            catch (Exception ex) { }
            #endregion

            #region Create a sample comment
            var commentsRepository = new NccCommentsRepository(nccDbConetxt);
            var commentsService    = new NccCommentsService(commentsRepository);
            try
            {
                enDemoContent = "This is a sample comment.";
                bnDemoContent = "এটি একটি নমুনা মন্তব্য।";
                NccComment commentItem = new NccComment();
                commentItem.Metadata = "DEMODATA";
                commentItem.Name     = "Sample Comments";
                commentItem.Content  = enDemoContent;
                if (Language == "bn")
                {
                    commentItem.Content = bnDemoContent;
                }
                commentItem.CommentStatus = NccComment.NccCommentStatus.Approved;
                commentItem.Post          = postService.LoadAll().FirstOrDefault();
                commentsService.Save(commentItem);
            }
            catch (Exception ex) { }
            #endregion

            #region Create sample menu
            var menuRepository     = new NccMenuRepository(nccDbConetxt);
            var menuItemRepository = new NccMenuItemRepository(nccDbConetxt);
            var menuService        = new NccMenuService(menuRepository, menuItemRepository);

            try
            {
                NccMenu nccMenu = new NccMenu()
                {
                    Name         = "Main Menu",
                    Position     = "Navigation",
                    MenuOrder    = 1,
                    MenuLanguage = ""
                };
                if (Language == "bn")
                {
                    nccMenu.MenuItems.Add(new NccMenuItem()
                    {
                        Action     = "",
                        Controller = "",
                        Data       = "",
                        //Id = item.Id,
                        MenuActionType = NccMenuItem.ActionType.Url,
                        MenuOrder      = 1,
                        Module         = "",
                        Name           = "হোম",
                        Target         = "_self",
                        Url            = "/"
                    });
                    nccMenu.MenuItems.Add(new NccMenuItem()
                    {
                        Action     = "",
                        Controller = "",
                        Data       = "",
                        //Id = item.Id,
                        MenuActionType = NccMenuItem.ActionType.Url,
                        MenuOrder      = 2,
                        Module         = "",
                        Name           = "নমুনা পৃষ্ঠা",
                        Target         = "_self",
                        Url            = "/নমুনা-পৃষ্ঠা"
                    });
                    nccMenu.MenuItems.Add(new NccMenuItem()
                    {
                        Action     = "",
                        Controller = "",
                        Data       = "",
                        //Id = item.Id,
                        MenuActionType = NccMenuItem.ActionType.Url,
                        MenuOrder      = 3,
                        Module         = "",
                        Name           = "ব্লগ পোস্ট",
                        Target         = "_self",
                        Url            = "/Post"
                    });
                    nccMenu.MenuItems.Add(new NccMenuItem()
                    {
                        Action     = "",
                        Controller = "",
                        Data       = "",
                        //Id = item.Id,
                        MenuActionType = NccMenuItem.ActionType.Url,
                        MenuOrder      = 4,
                        Module         = "",
                        Name           = "ব্লগ বিভাগ",
                        Target         = "_self",
                        Url            = "/Category"
                    });
                }
                else
                {
                    nccMenu.MenuItems.Add(new NccMenuItem()
                    {
                        Action     = "",
                        Controller = "",
                        Data       = "",
                        //Id = item.Id,
                        MenuActionType = NccMenuItem.ActionType.Url,
                        MenuOrder      = 1,
                        Module         = "",
                        Name           = "Home",
                        Target         = "_self",
                        Url            = "/"
                    });
                    nccMenu.MenuItems.Add(new NccMenuItem()
                    {
                        Action     = "",
                        Controller = "",
                        Data       = "",
                        //Id = item.Id,
                        MenuActionType = NccMenuItem.ActionType.Url,
                        MenuOrder      = 2,
                        Module         = "",
                        Name           = "Sample Page",
                        Target         = "_self",
                        Url            = "/Sample-Page"
                    });
                    nccMenu.MenuItems.Add(new NccMenuItem()
                    {
                        Action     = "",
                        Controller = "",
                        Data       = "",
                        //Id = item.Id,
                        MenuActionType = NccMenuItem.ActionType.Url,
                        MenuOrder      = 3,
                        Module         = "",
                        Name           = "Blog Posts",
                        Target         = "_self",
                        Url            = "/Post"
                    });
                    nccMenu.MenuItems.Add(new NccMenuItem()
                    {
                        Action     = "",
                        Controller = "",
                        Data       = "",
                        //Id = item.Id,
                        MenuActionType = NccMenuItem.ActionType.Url,
                        MenuOrder      = 4,
                        Module         = "",
                        Name           = "Blog Categories",
                        Target         = "_self",
                        Url            = "/Category"
                    });
                }

                menuService.Save(nccMenu);
            }
            catch (Exception ex) { }
            #endregion

            #region Create sample widget
            //var currentWebsite = nccWebSiteService.LoadAll().FirstOrDefault();
            //var nccWebSiteWidget = new NccWebSiteWidget()
            //{
            //    WebSite = currentWebsite,
            //    WidgetConfigJson = "",
            //    ModuleId = "NetCoreCMS.Core.Modules.Cms",
            //    WidgetId = "NetCoreCms.Modules.Cms.CmsSearch",
            //    ThemeId = "com.NetCoreCMS.themes.NccSeventeen",
            //    LayoutName = "SiteLayout",
            //    Zone = "RightSidebar",
            //    WidgetOrder = 1,
            //    WidgetData = "",
            //};
            //nccWebSiteWidgetService.Save(nccWebSiteWidget);
            #endregion
        }
Exemplo n.º 18
0
 public CmsHomeController(NccPageService pageService, NccPostService nccPostService, ILoggerFactory factory)
 {
     _pageService = pageService;
     _postService = nccPostService;
     _logger      = factory.CreateLogger <CmsHomeController>();
 }