Exemple #1
0
        public async Task AddOrUpdate(WarrantyStatusCacheModel model)
        {
            try
            {
                var warrantyStatuses = await LoadFromRedis();

                var warrantyStatus = warrantyStatuses.FirstOrDefault(c => c.Id == model.Id);
                if (warrantyStatus == null)
                {
                    warrantyStatuses.Add(model);
                }
                else
                {
                    warrantyStatus.Name       = model.Name;
                    warrantyStatus.Color      = model.Color;
                    warrantyStatus.SortOrder  = model.SortOrder;
                    warrantyStatus.IsSendSms  = model.IsSendSms;
                    warrantyStatus.SmsContent = model.SmsContent;
                }

                await DistributedCache.Set(_cacheKey,
                                           warrantyStatuses);
            }
            catch (Exception exception)
            {
                _logger.Info(exception.ToString);
            }
        }
Exemple #2
0
 public WarrantyStatusModel(WarrantyStatusCacheModel model)
 {
     Id        = model.Id;
     Name      = model.Name;
     Color     = model.Color;
     SortOrder = model.SortOrder;
 }
 public UpdateWarrantyStatusModel(WarrantyStatusCacheModel model)
 {
     Id         = model.Id;
     Name       = model.Name;
     Color      = model.Color;
     SortOrder  = model.SortOrder;
     IsSendSms  = model.IsSendSms;
     SmsContent = model.SmsContent;
 }
 public WarrantyStatusSimpleModel(WarrantyStatusCacheModel model)
 {
     Id   = model.Id;
     Name = model.Name;
 }