public async Task AddOrUpdate(ReceiptDescriptionCacheModel model) { try { var receiptDescriptions = await LoadFromRedis(); var receiptDescription = receiptDescriptions.FirstOrDefault(c => c.Id == model.Id); if (receiptDescription == null) { receiptDescriptions.Add(model); } else { receiptDescription.Name = model.Name; } await DistributedCache.Set(_cacheKey, receiptDescriptions); } catch (Exception exception) { _logger.Info(exception.ToString); } }
public UpdateReceiptDescriptionModel(ReceiptDescriptionCacheModel model) { Id = model.Id; Name = model.Name; }