Пример #1
0
        public ActionResult CreateNewPassword(string strUserId, DateTime timeSend)
        {
            try
            {
                DateTime activeTimeCheck = DateTime.Now;
                AccountBusiness ab = new AccountBusiness();
                int userId = 0;
                string salt = strUserId.Substring(strUserId.Length - 88);
                List<User> lstUser = db.Users.ToList();
                foreach (var item in lstUser)
                {
                    if (ab.CreateIdHash(item.UserId, salt) == strUserId)
                    {
                        userId = item.UserId;
                    }
                }
                double check = (activeTimeCheck - timeSend).TotalMinutes;
                if (check > 1440)
                {
                    ViewBag.outOfTime = "";
                }

                if (userId != 0)
                {
                    ViewBag.userId = userId;
                    return View();
                }
                else
                {
                    return RedirectToAction("Index", "Error");
                }
            }
            catch
            {
                return RedirectToAction("Index", "Error");
            }
        }