public async Task <ActionResult> LiveApply(ApplyLiveViewModel model) { if (ModelState.IsValid && new reCAPTCHAHelper().Validate(Request["g-recaptcha-response"])) { //await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false); // For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771 // 傳送包含此連結的電子郵件 //string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id); //var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme); //await UserManager.SendEmailAsync(user.Id, "熊i猜Email驗證信", "請按此連結確認您的帳戶 <a href=\"" + callbackUrl + "\">驗證</a>"); var apply = new LiveApply { name = model.Name, Email = model.Email, livecount = model.livecount, comment = model.comment, valid = 0, lievlink = model.lievlink, inpdate = DateTime.Now, createComment = model.createComment }; new UserRepository().applylive(apply); var content = "<h2 style='text-align: center;'>申請通知信</h2>" + "<div style='text-align: center;padding:0 14%;'>" + "<h4 style='color:#222'>親愛的直播主您好:<p>" + "我們已經收到您的申請<p>" + "<h3 style='color:#500050'>熊i猜會在5~7個工作日審核您的資格,審核通過將為您寄送相關文件及合約書至您的信箱,還請您耐心等候,如有任何問題,可至<a href='https://www.facebook.com/funbet.esport/'>熊i猜粉絲團</a>發訊詢問喔!<br>" + "(本通知為自動發送,請勿直接回信詢問,以避免延誤問題解決時間。)</h3><br>"; var EmailContent = EmailTemplatesService.GetLiveEmailHTML(content); //寄送通知信 new MailServiceMailgun().ChangeSend("競猜直播主申請通知信", EmailContent, model.Email, ""); return(RedirectToAction("Index", "Home", new { message = "申請成功,已寄送通知信至你的信箱" })); } // 如果執行到這裡,發生某項失敗,則重新顯示表單 return(View(model)); }
public void applylive(LiveApply la) { Db.LiveApply.Add(la); Db.SaveChanges(); }