public static Return ClearAllCache() { try { ContextHelper.ClearAllMemoryCache(); FileCacheHelper.ClearAllCache(); RedisCacheHelper.ClearAllCache(); var webserviceRequests = FrameworkLibrary.WebserviceRequestsMapper.GetAll(); foreach (var item in webserviceRequests) { var context = BaseMapper.GetObjectFromContext(item); if (context != null) { BaseMapper.DeleteObjectFromContext(context); } } var returnObj = BaseMapper.SaveDataModel(); return(BaseMapper.GenerateReturn()); } catch (Exception ex) { return(BaseMapper.GenerateReturn(ex)); } }
public static void RemoveChildMediaTypes(MediaType obj) { var mediaTypes = GetDataModel().MediaTypes; foreach (var type in mediaTypes) { var removeMediaTypes = type.MediaTypes.Where(i => i.ID == obj.ID).ToList(); foreach (var removeMediaType in removeMediaTypes) { type.MediaTypes.Remove(removeMediaType); } } var fields = obj.Fields.ToList(); foreach (var field in fields) { BaseMapper.DeleteObjectFromContext(field); } obj.MediaTypes.Clear(); }