Esempio n. 1
0
        public async Task <ActionResult> DenyByEmail(string UserId)
        {
            AdminProveModel prove       = new AdminProveModel();
            EmailServices   mail        = new EmailServices();
            var             userprofile = reg.profile(UserId);
            var             user        = reg.Dprofile(UserId);

            var deny = reg.Deny(UserId);


            string sms  = string.Format("You are denied due to wrong Registration Information");
            string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.UserId);

            var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.UserId, code = code }, protocol: Request.Url.Scheme);
            await UserManager.SendEmailAsync(user.UserId, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>, You are denied due to wrong Registration Information");

            mail.SendSMS(user.PhoneNumber, sms);
            return(RedirectToAction("Index", "Home"));
        }
Esempio n. 2
0
        public async Task <ActionResult> ApproveByEmail(string UserId)
        {
            AdminProveModel prove       = new AdminProveModel();
            EmailServices   mail        = new EmailServices();
            Random          r           = new Random();
            int             regcode     = r.Next(1000, 9999);
            var             userprofile = reg.profile(UserId);
            var             user        = reg.Dprofile(UserId);
            var             approve     = reg.Approve(UserId);

            reg.insertRegCode(UserId, regcode);
            string sms  = string.Format("Your Registration is successful.This is your verification code {0}", regcode);
            string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.UserId);

            var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.UserId, code = code }, protocol: Request.Url.Scheme);
            await UserManager.SendEmailAsync(user.UserId, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>, Your verification Code is <p> " + regcode + "</p>");

            mail.SendSMS(user.PhoneNumber, sms);
            return(RedirectToAction("Index", "Home"));
        }