public static bool?IsSaved(IPrincipal user, Domain.Models.ContentType type, int id) { var identity = user.Identity; if (identity.IsAuthenticated) { var q = new QueryUserSaves(type).SetUserContext(user); var d = q.Execute(); return(d.Contains(id)); //string userName = identity.Name; //string cacheKey = CachingKey.UserSavedItems(type, userName); //if (!CacheHandler.Instance.Exists(cacheKey)) //{ // var q = new QueryUserSaves(type).SetUserContext(user); // var d = q.Execute(); // return d.Contains(id); //} //else //{ // return CacheHandler.Instance.SetExists(cacheKey, id); //} } return(null); }
public static bool?IsSaved(Domain.Models.ContentType type, int id) { var identity = System.Threading.Thread.CurrentPrincipal.Identity; if (identity.IsAuthenticated) { string userName = identity.Name; string cacheKey = CachingKey.UserSavedItems(type, userName); if (!CacheHandler.Instance.Exists(cacheKey)) { var q = new QueryUserSaves(type); var d = q.Execute(); return(d.Contains(id)); } else { return(CacheHandler.Instance.SetExists(cacheKey, id)); } } return(null); }