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