Пример #1
0
        public JsonResult getSecurityQuestionJSON(string id)
        {
            var db = new UsersDataContext();
            var userProfile = db.S1_Users_GetUserProfileByName(id).SingleOrDefault();

            if (userProfile != null)
            {
                if (!userProfile.IsApproved)
                {
                    return new JsonResult { Data = new { SecurityQuestion = "unauthorized", Unauthorized = "true" } };
                }
                else
                {
                    string SecurityQuestion = userProfile.PasswordQuestion;
                    return new JsonResult { Data = new { SecurityQuestion = SecurityQuestion, Unauthorized = "false" } };
                }

            }
            else
            {
                return new JsonResult { Data = new { SecurityQuestion = "", Unauthorized = "false" } };
            }
        }