public async Task AddOrUpdate(TaskPriorityCacheModel model) { try { var taskPriorities = await LoadFromRedis(); var taskPriority = taskPriorities.FirstOrDefault(c => c.Id == model.Id); if (taskPriority == null) { taskPriorities.Add(model); } else { taskPriority.Name = model.Name; taskPriority.Color = model.Color; taskPriority.SortOrder = model.SortOrder; } await DistributedCache.Set(_cacheKey, taskPriorities); } catch (Exception exception) { _logger.Info(exception.ToString); } }
public TaskPriorityModel(TaskPriorityCacheModel model) { Id = model.Id; Name = model.Name; Color = model.Color; SortOrder = model.SortOrder; }