private void btnGetById_Click(object sender, EventArgs e) { RedisServiceStackHelper redis = new RedisServiceStackHelper(); var model = redis.GetByKey <Notification>(txtId.Text.Trim()); if (model != null) { var dataSource = notificationList.Where(x => x.ID == int.Parse(txtId.Text.Trim())).ToList(); dataGridView1.DataSource = dataSource; } }
private void GetAll() { RedisServiceStackHelper redis = new RedisServiceStackHelper(); notificationList = redis.GetAll <Notification>().ToList(); if (notificationList.Count == 0) { notificationList = notificationRepository.GetAll(); } dataGridView1.DataSource = notificationList; }
private void btnCacheAll_Click(object sender, EventArgs e) { RedisServiceStackHelper redis = new RedisServiceStackHelper(); redis.DeleteAll <Notification>(); foreach (var item in notificationList) { redis.SetObject <Notification>(item); } MessageBox.Show("Cached successful!"); }