public IActionResult General() { var profile = GetProfile(); var storage = new BlogStorage(""); var model = new SettingsGeneral { Profile = profile, BlogThemes = BlogSettings.BlogThemes, Title = BlogSettings.Title, Description = BlogSettings.Description, BlogTheme = BlogSettings.Theme, Logo = BlogSettings.Logo, Avatar = ApplicationSettings.ProfileAvatar, Image = BlogSettings.Cover, EmailKey = _db.CustomFields.GetValue(CustomType.Application, 0, Constants.SendGridApiKey), BlogHead = _db.CustomFields.GetValue(CustomType.Application, 0, Constants.HeadCode), BlogFooter = _db.CustomFields.GetValue(CustomType.Application, 0, Constants.FooterCode) }; return(View(_theme + "General.cshtml", model)); }
public IActionResult General(SettingsGeneral model) { model.BlogThemes = BlogSettings.BlogThemes; model.Profile = GetProfile(); if (ModelState.IsValid) { BlogSettings.Title = model.Title; BlogSettings.Description = model.Description; BlogSettings.Logo = model.Logo; ApplicationSettings.ProfileAvatar = model.Avatar; BlogSettings.Cover = model.Image; BlogSettings.Theme = model.BlogTheme; this.db.CustomFields.SetCustomField(CustomType.Application, 0, Constants.Title, model.Title); this.db.CustomFields.SetCustomField(CustomType.Application, 0, Constants.Description, model.Description); this.db.CustomFields.SetCustomField(CustomType.Application, 0, Constants.ProfileLogo, model.Logo); this.db.CustomFields.SetCustomField(CustomType.Application, 0, Constants.ProfileAvatar, model.Avatar); this.db.CustomFields.SetCustomField(CustomType.Application, 0, Constants.ProfileImage, model.Image); this.db.CustomFields.SetCustomField(CustomType.Application, 0, Constants.BlogTheme, model.BlogTheme); this.db.CustomFields.SetCustomField(CustomType.Application, 0, Constants.SendGridApiKey, model.EmailKey); this.db.CustomFields.SetCustomField(CustomType.Application, 0, Constants.HeadCode, model.BlogHead); this.db.CustomFields.SetCustomField(CustomType.Application, 0, Constants.FooterCode, model.BlogFooter); model.Profile.BlogTheme = model.BlogTheme; this.db.Complete(); ViewBag.Message = "Updated"; } return(View(this.theme + "General.cshtml", model)); }