Ejemplo n.º 1
0
        public static GeneralSeoSettingsModel MergeViewWithModelGeneralSettings(GeneralSeoSettingsModel model, GeneralSeoSettingsView view)
        {
            model.Title   = view.Title;
            model.MainUrl = view.MainUrl;

            return(model);
        }
Ejemplo n.º 2
0
        public static GeneralSeoSettingsView ConvertToViewGeneralSettings(GeneralSeoSettingsModel result)
        {
            var generalSettings = new GeneralSeoSettingsView
            {
                Id      = result.Id,
                Title   = result.Title,
                MainUrl = result.MainUrl
            };

            return(generalSettings);
        }
Ejemplo n.º 3
0
 public async Task <bool> SetSeoSettings(GeneralSeoSettingsModel result)
 {
     _context.SeoSettings.Update(result);
     return(await _context.SaveChangesAsync() > 0);
 }
Ejemplo n.º 4
0
Archivo: Seed.cs Proyecto: jarmatys/CMS
        public static async Task SeedData(CMSContext context, UserManager <User> userManager)
        {
            // Seed dla podstawowych kont użytkowników
            if (!userManager.Users.Any())
            {
                var users = new List <User>
                {
                    new User
                    {
                        UserName = "******",
                        Email    = "*****@*****.**",
                        Name     = "admin",
                        Surname  = "adminowski"
                    },
                    new User
                    {
                        UserName = "******",
                        Email    = "*****@*****.**",
                        Name     = "user",
                        Surname  = "userowski"
                    }
                };

                foreach (var user in users)
                {
                    await userManager.CreateAsync(user, "haslo");
                }
            }

            // Seed dla ustawień systemu
            if (!context.BlogSettings.Any())
            {
                var blogSettings = new BlogModel
                {
                    CommentsNotify = false,
                    PostPerPage    = 12,
                    AllowComments  = false,
                    DateFormat     = "dd-MM-yyyy",
                    TimeFormat     = "H:mm:ss"
                };

                await context.BlogSettings.AddAsync(blogSettings);

                await context.SaveChangesAsync();
            }

            // seed dla ustawień e-maila
            if (!context.EmailSettings.Any())
            {
                var emailsettings = new EmailModel
                {
                    Host      = "smtp.gmail.com",
                    Port      = 587,
                    EmailTo   = "*****@*****.**",
                    EmailFrom = "*****@*****.**",
                    Password  = "******",
                    EnableSSL = true,
                };

                await context.EmailSettings.AddAsync(emailsettings);

                await context.SaveChangesAsync();
            }

            // Seed dla polityki prywatności
            if (!context.PrivacyPolicySettings.Any())
            {
                var privacySettings = new PrivacyPolicyModel
                {
                    PageUrl     = "https://test.pl",
                    CompanyName = "Nazwa firmy",
                    Street      = "ul. ulicowska 45",
                    City        = "miasto",
                    ZipCode     = "12-345",
                    Email       = "*****@*****.**",
                    HostingName = "hosting.pl"
                };

                await context.PrivacyPolicySettings.AddAsync(privacySettings);

                await context.SaveChangesAsync();
            }

            // Seed dla polityki prywatności
            if (!context.IntegrationSettings.Any())
            {
                var integrationSettings = new IntegrationModel {
                };

                await context.IntegrationSettings.AddAsync(integrationSettings);

                await context.SaveChangesAsync();
            }

            // Seed dla ogólnych ustawień seo
            if (!context.SeoSettings.Any())
            {
                var generalSettings = new GeneralSeoSettingsModel
                {
                    MainUrl = "https://cmsopen.net",
                    Title   = "Twoja pierwsza strona w systemie CMSOPEN"
                };

                await context.SeoSettings.AddAsync(generalSettings);

                await context.SaveChangesAsync();
            }
        }