Exemple #1
0
 public AccountController(RoleManager <IdentityRole> roleManager, UserManager <AppUser> userManager, SignInManager <AppUser> signInManager, BlogezyDbContext db)
 {
     _userManager   = userManager;
     _signInManager = signInManager;
     _roleManager   = roleManager;
     _db            = db;
 }
 public AccountController(UserManager <UserApp> userManager,
                          SignInManager <UserApp> signInManager,
                          BlogezyDbContext blogezyDb)
 {
     _userManager   = userManager;
     _signInManager = signInManager;
     _blogezyDb     = blogezyDb;
 }
Exemple #3
0
 public HomeController(BlogezyDbContext blogezyDb)
 {
     _blogezyDb = blogezyDb;
 }
Exemple #4
0
 public MenuViewComponent(BlogezyDbContext blogezyDbContext)
 {
     _blogezyDbContext = blogezyDbContext;
 }
 public SocialAccountsController(BlogezyDbContext db)
 {
     _db = db;
 }
Exemple #6
0
 public AdminInfoViewComponent(BlogezyDbContext db)
 {
     _db = db;
 }
        public static void Main(string[] args)
        {
            IWebHost webHost = CreateWebHostBuilder(args).Build();

            using (IServiceScope scopedService = webHost.Services.CreateScope())
            {
                using (BlogezyDbContext dbContext = scopedService.ServiceProvider.GetRequiredService <BlogezyDbContext>())
                {
                    if (!dbContext.Articles.Any())
                    {
                        #region default articles
                        Article article = new Article()
                        {
                            Name         = "Beautiful Day With Friends In Paris",
                            Description  = "Whether an identity or campaign, we make your brand visible, relevant and effective by placing the digital at the center of its ecosystem, without underestimating the power of traditional media. Whether an identity or campaign, we make your brand visible.",
                            Detail       = "Whether an identity or campaign, we make your brand visible, relevant and effective by placing the digital at the center of its ecosystem, without underestimating the power of traditional media. Whether an identity or campaign, we make your brand visible.",
                            PhotoPath    = "blog-1.jpg",
                            AddedDate    = DateTime.Now,
                            EditDate     = DateTime.Now,
                            ViewCount    = 0,
                            CommentCount = 0
                        };

                        #endregion

                        #region default categories
                        Category branding = new Category()
                        {
                            Name         = "Branding",
                            ArticleCount = 0
                        };

                        Category design = new Category()
                        {
                            Name         = "Design",
                            ArticleCount = 0
                        };

                        #endregion

                        dbContext.Articles.Add(article);
                        dbContext.Categories.AddRange(branding, design);
                        dbContext.SaveChanges();

                        ArticleCategory ac1 = new ArticleCategory()
                        {
                            ArticleId  = article.Id,
                            CategoryId = branding.Id
                        };

                        ArticleCategory ac2 = new ArticleCategory()
                        {
                            ArticleId  = article.Id,
                            CategoryId = design.Id
                        };

                        dbContext.ArticleCategories.AddRange(ac1, ac2);
                        dbContext.SaveChanges();
                    }


                    if (!dbContext.Menus.Any())
                    {
                        #region default menus
                        Menu home = new Menu()
                        {
                            Name       = "Home",
                            Slug       = "home",
                            Sorting    = 1,
                            Visibility = true,
                            Controller = "Home",
                            Action     = "Index"
                        };

                        Menu features = new Menu()
                        {
                            Name       = "Features",
                            Slug       = "features",
                            Sorting    = 2,
                            Visibility = true
                        };

                        #endregion

                        dbContext.Menus.AddRange(home, features);
                        dbContext.SaveChanges();

                        #region sub menus
                        SubMenu subCategoryStandartPost = new SubMenu()
                        {
                            Action     = "StandartPost",
                            Controller = "Home",
                            Name       = "Standart post",
                            MenuId     = features.Id
                        };

                        SubMenu subCategoryVideoPost = new SubMenu()
                        {
                            Action     = "VideoPost",
                            Controller = "Home",
                            Name       = "Video post",
                            MenuId     = features.Id
                        };
                        #endregion

                        dbContext.SubMenus.AddRange(subCategoryVideoPost, subCategoryStandartPost);
                        dbContext.SaveChanges();
                    }

                    if (!dbContext.SocialAccounts.Any())
                    {
                        #region default menus
                        SocialAccount facebok = new SocialAccount()
                        {
                            Name = "Facebook",
                            Url  = "facebook.com",
                            Icon = "fab fa-facebook-f"
                        };

                        SocialAccount twitter = new SocialAccount()
                        {
                            Name = "Twitter",
                            Url  = "twitter.com",
                            Icon = "fab fa-twitter"
                        };

                        SocialAccount instagram = new SocialAccount()
                        {
                            Name = "Instagram",
                            Url  = "instagram.com",
                            Icon = "fab fa-instagram"
                        };

                        SocialAccount pinterest = new SocialAccount()
                        {
                            Name = "Pinterest",
                            Url  = "pinterest.com",
                            Icon = "fab fa-pinterest-p"
                        };

                        #endregion

                        dbContext.SocialAccounts.AddRange(facebok, twitter, instagram, pinterest);
                        dbContext.SaveChanges();
                    }

                    if (!dbContext.AdminInfos.Any())
                    {
                        AdminInfo adminInfo = new AdminInfo()
                        {
                            Name      = "Murad",
                            Surname   = "Ibrahimkhanli",
                            About     = "Pul pres Heyat Impres!!!",
                            PhotoPath = "admin.jpg"
                        };
                        dbContext.AdminInfos.Add(adminInfo);
                        dbContext.SaveChanges();
                    }
                    UserAndRoleCreater.CreateAsync(scopedService, dbContext).Wait();
                }
            }

            webHost.Run();
        }
 public PagesController(BlogezyDbContext db)
 {
     _db = db;
 }
 public HomeController(BlogezyDbContext db)
 {
     _db = db;
 }
 public PopularPostViewComponent(BlogezyDbContext db)
 {
     _db = db;
 }
        public async static Task Seed(IWebHost webhost)
        {
            using (IServiceScope scopedService = webhost.Services.CreateScope())
            {
                using (BlogezyDbContext dbContext = scopedService.ServiceProvider.GetRequiredService <BlogezyDbContext>())
                {
                    //ADDING SOME ARTICLES IF THERE ISN'T ANY IN DATABASE
                    if (!await dbContext.Articles.AnyAsync())
                    {
                        dbContext.Articles.AddRange(new List <Article>()
                        {
                            new Article()
                            {
                                Image       = @"https://nomadicboys.com/wp-content/uploads/2015/12/Public-caning-in-Aceh-Indonesia-by-Sharia-police.jpg",
                                Name        = "LGBT Life in Indonesia",
                                PublicDate  = DateTime.Now,
                                Category    = "Life in Indonesia",
                                Description =
                                    #region Descritpion
                                    "Special police task forces have been set up to target LGBT activities in Indonesia. " +
                                    "Police recently arrested fifty-eight men after a police raid on a sauna in Jakarta." +
                                    "They accused the men of spreading naked images on social media and now the men" +
                                    " are facing up to 10 years in jail charged under the country’s pornography laws." +
                                    " Homosexuality is legal in most of Indonesia, but a case in the country’s top court may" +
                                    " criminalise homosexual acts. The United Nations has called on Indonesia " +
                                    "to stop the crackdown and to tackle anti-LGBT stigma."


                                    #endregion
                            },
                            new Article()
                            {
                                Image       = @"https://i.etsystatic.com/10656396/r/il/3295b3/1446321499/il_570xN.1446321499_inql.jpg",
                                Name        = "Fox in a Dishwasher",
                                PublicDate  = DateTime.Now,
                                Category    = "Animals",
                                Description =
                                    #region Descritpion
                                    "A fox cub, presumably looking for food, got itself stuck in a dishwasher in a London household. " +
                                    "Luckily for it, the owner found it and is a vet.With years of experience, " +
                                    "he could tell that the fox was just a few months old and seemed to be very scared. " +
                                    "He removed the dishwasher’s bottom trolley and, " +
                                    "after some persuasion with a sweeping brush, the frightened animal crept out of the appliance" +
                                    " and made a dash for the garden where people later saw it with its mother.."


                                    #endregion
                            }
                        });
                    }

                    //ADDING SOME USERS IF THERE ISN'T ANY IN DATABASE

                    if (!await dbContext.AppUsers.AnyAsync())
                    {
                        dbContext.AppUsers.AddRange(new List <AppUser>()
                        {
                            new AppUser()
                            {
                                UserName = "******", Email = "*****@*****.**", Role = Role.User, Password = "******"
                            },
                            new AppUser()
                            {
                                UserName = "******", Email = "*****@*****.**", Role = Role.User, Password = "******"
                            },
                            new AppUser()
                            {
                                UserName = "******", Email = "*****@*****.**", Role = Role.User, Password = "******"
                            },
                            new AppUser()
                            {
                                UserName = "******", Email = "*****@*****.**", Role = Role.User, Password = "******"
                            },
                            new AppUser()
                            {
                                UserName = "******", Email = "*****@*****.**", Role = Role.Admin, Password = "******"
                            }
                        });
                    }

                    // ADDING SOME MENU items
                    if (!await dbContext.Menus.AnyAsync())
                    {
                        dbContext.Menus.AddRange(new List <Menu>()
                        {
                            new Menu()
                            {
                                Name = "Home", ActionName = "", ControllerName = "", Visibility = true
                            },
                            new Menu()
                            {
                                Name = "Features", ActionName = "", ControllerName = "", Visibility = true
                            },
                            new Menu()
                            {
                                Name = "Lifestyle", ActionName = "", ControllerName = "", Visibility = true
                            },
                            new Menu()
                            {
                                Name = "Music", ActionName = "", ControllerName = "", Visibility = true
                            },
                            new Menu()
                            {
                                Name = "Contacts", ActionName = "", ControllerName = "", Visibility = true
                            },
                            new Menu()
                            {
                                Name = "About", ActionName = "About", ControllerName = "Home", Visibility = true
                            },
                            new Menu()
                            {
                                Name = "Admin Panel", ActionName = "AdminPanel", ControllerName = "Home", Visibility = false
                            },
                        });
                    }
                    await dbContext.SaveChangesAsync();
                }
            }
        }
Exemple #12
0
 public HomeController(BlogezyDbContext blogezyDbContext)
 {
     _blogezyDbContext = blogezyDbContext;
 }
 public CategoriesController(BlogezyDbContext db)
 {
     _db = db;
 }
Exemple #14
0
 public CategoryViewComponent(BlogezyDbContext db)
 {
     _db = db;
 }
Exemple #15
0
 public ArticlesController(BlogezyDbContext db)
 {
     _db = db;
 }
 public HomeController(BlogezyDbContext dbContext)
 {
     BlogezyDbContext = dbContext;
 }
 public MenuViewComponent(BlogezyDbContext db)
 {
     _db = db;
 }
 public RightViewComponent(BlogezyDbContext db)
 {
     _db = db;
 }