public ContactConfig GetContactConfig(Config entity) { ContactConfig cConfig = null; if (entity.ContactConfig != null) { cConfig = JsonConvert.DeserializeObject <ContactConfig>(entity.ContactConfig); } if (cConfig == null) { cConfig = new ContactConfig(); } return(cConfig); }
public AboutController( ILogger <AboutController> log, IOptions <ContactConfig> contactOpts, IBlogService blogService, ICaptchaService captchaService, IEmailService emailService, RazorViewToStringRenderer razorRenderer) : base(log) { if (contactOpts == null) { throw new ArgumentNullException(nameof(contactOpts)); } _config = contactOpts.Value; _blogService = blogService ?? throw new ArgumentNullException(nameof(blogService)); _captchaService = captchaService ?? throw new ArgumentNullException(nameof(captchaService)); _emailService = emailService ?? throw new ArgumentNullException(nameof(emailService)); _razorRenderer = razorRenderer ?? throw new ArgumentNullException(nameof(razorRenderer)); }
public void UpdateContactConfig(Config entity, ContactConfig model) { entity.ContactConfig = JsonConvert.SerializeObject(model); }