public IEnumerable <Resource> Get() { try { return(_ls.GetAll(CurrentUserName)); } catch (Exception ex) { return(null); } }
public string getAll() { var cacheKey1 = HttpRuntime.Cache.Get("resources"); var cacheKey2 = HttpRuntime.Cache.Get("resourcesTranslation"); if (cacheKey1 == null || cacheKey2 == null) { var resources = resourcesService.GetAll(); HttpRuntime.Cache.Insert("resources", resources); var resourcesTranslation = resourcesTranslationService.GetAll(); HttpRuntime.Cache.Insert("resourcesTranslation", resourcesTranslation); var res = new { r = resources, rt = resourcesTranslation }; return(Newtonsoft.Json.JsonConvert.SerializeObject(res)); } else { var resources = ((List <Resources>)cacheKey1); var resourcesTranslation = ((List <ResourcesTranslationVM>)cacheKey2); var res = new { r = resources, rt = resourcesTranslation }; return(Newtonsoft.Json.JsonConvert.SerializeObject(res)); } }