protected override bool AuthorizeCore(HttpContextBase httpContext)
        {
            userProfileService = new UserProfileServices(new DealsDB());

            bool authorize = false;

            if (HttpContext.Current.Session[KeyList.SessionKeys.UserID] != null)
            {
                var userSessionId = HttpContext.Current.Session[KeyList.SessionKeys.UserID].ToString();

                var user = userProfileService.GetByID(Convert.ToInt32(userSessionId));
                foreach (var role in allowedroles)
                {
                    if (user != null && user.UserType1.UserTypeName.Contains(role))

                    {
                        authorize = true; /* return true if Entity has current user(active) with specific role */
                    }
                }
                userProfileService.Dispose();
                return(authorize);
            }
            else
            {
                return(authorize);
            }
        }
        public ActionResult ResetPassword(AccountModels.ResetPass ResetPassUser)
        {
            if (ModelState.IsValid)
            {
                UserProfile GetUserForResetPass = UserProfileService.GetByID(ResetPassUser.ForgotUserID);
                if (GetUserForResetPass != null)
                {
                    GetUserForResetPass.Password = UserProfileService.PasswordEncrypt(ResetPassUser.Password.ToString());
                    if (UserProfileService.UpdateUser(GetUserForResetPass) == true)
                    {
                        Logs GenerateLog = new Logs();

                        GenerateLog.CreateLog(GetUserForResetPass.UserId, KeyList.LogMessages.ResetPassword);
                        UserProfileService.RemoveLinkForResetPassword(GetUserForResetPass.UserId);
                        return(Redirect(Url.Action("Index", "Register_Login")));
                    }
                }
                return(Redirect(Url.Action("ForgotPassword", "Activation")));
            }
            return(View(ResetPassUser));
        }