Esempio n. 1
0
        public ActionResult GetAllActivities()
        {
            var oRequestCode = new Random().Next(0, int.MaxValue);
            var oRequestTime = DateTime.Now;

            LogHelper.InsertServiceLogs("search/allactivities (GetAllActivities) (" + oRequestCode + ")", null, oRequestTime);
            var activities = new List <string>();
            var oResult    = MemoryCacheHelper.GetValue("GetAllActivities");

            if (oResult == null)
            {
                activities = FeedHelper.GetAllActivities();
                MemoryCacheHelper.Add("GetAllActivities", activities, DateTimeOffset.UtcNow.AddHours(2));
            }
            else
            {
                activities = oResult as List <string>;
            }
            LogHelper.InsertServiceLogs("search/allactivities (GetAllActivities) - Response (" + oRequestCode + ")", null, oRequestTime, DateTime.Now);
            return(Ok(new { items = activities }));
        }