Пример #1
0
        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);
            }
        }
Пример #2
0
 public TaskPriorityModel(TaskPriorityCacheModel model)
 {
     Id        = model.Id;
     Name      = model.Name;
     Color     = model.Color;
     SortOrder = model.SortOrder;
 }