public ActionResult SetGmailAccount(MailSettingsModel model) { if (string.IsNullOrEmpty(model.UserName)) { return(this.Json(new OperationResultModel(false, "Please enter account"))); } if (string.IsNullOrEmpty(model.Password)) { return(this.Json(new OperationResultModel(false, "Please enter password"))); } var user = this.dbContext.Users.FirstOrDefault(u => u.UserName == this.User.Identity.Name); if (user == null) { return(this.Json(new OperationResultModel(false, "User not found. Please register."))); } user.GmailAccount = model.UserName; user.GmailPassword = model.Password; this.dbContext.SaveChanges(); return(this.Json(new OperationResultModel(true))); }
public Emailing(IOptions <MailSettingsModel> mailSettings) { _mailSettings = mailSettings.Value; }