Exemple #1
0
 public ActionResult ClearCache()
 {
     try
     {
         BaseCacheHelper.Remove("GetUsersForPasswordReset");
         return(Json(new { status = true, msg = "მომხმარებლები ჩაიტვირთა ხელახლა" }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(Json(new { status = false, msg = ex.Message }, JsonRequestBehavior.AllowGet));
     }
 }
Exemple #2
0
        private IEnumerable <UserViewModel> GetUsersForPasswordReset()
        {
            var result = BaseCacheHelper.Get <List <UserViewModel> >("GetUsersForPasswordReset");

            if (result == null)
            {
                result = ADHelper.GetUsersForPasswordReset()
                         .Select(u => new UserViewModel
                {
                    ID       = u.SamAccountName,
                    FullName = (u.Name ?? string.Empty).Trim(),
                    //EmailAddress = (string.IsNullOrWhiteSpace(u.EmailAddress) ? (u.UserPrincipalName ?? string.Empty) : string.Empty),
                    MobileNumber = ADHelper.GetUserPhone(u) ?? string.Empty,
                    Department   = ADHelper.GetUserDepartment(u) ?? string.Empty
                }).ToList();

                BaseCacheHelper.Add("GetUsersForPasswordReset", result);
            }

            return(result);
        }