コード例 #1
0
        public async Task <ActionResult> OnlyEmail(OnlyEmailViewModel data)
        {
            string key = CollectionOfMethods.GetHashString(data.Email);

            if (ModelState.IsValid)
            {
                ResetPassword newData = new ResetPassword()
                {
                    Id     = 4,
                    UserId = repoReset.GetUserWithEmail(data.Email).Id,
                    Key    = key,
                };
                repoReset.Save(newData);
                EmailService emailService = new EmailService();
                await emailService.SendEmailAsync(data.Email, @Resources.Web.ChangePasswordTheme,
                                                  TemplateForEmail.ForgotPassword(Url.Action("ResetPassword", "Account", new { Key = key }, Request.Url.Scheme)));

                return(RedirectToAction("WaitingForConfirm"));
            }
            else
            {
                //             Response.StatusCode = (int) HttpStatusCode.BadRequest;
                return(View(data));
            }
        }