private WelcomeMessage UpdateWelcomeMessage(ColidType type, string content)
        {
            Guard.IsNotEmpty(content);
            var entity = GetWelcomeMessage(type);

            entity.Content = content;

            return(_cache.Update(type.ToString(), () => _wmRepo.Update(entity)));
        }
示例#2
0
        public WelcomeMessage GetOne(ColidType type)
        {
            var welcomeMessage = FindByCondition(m => m.Type.Equals(type)).FirstOrDefault();

            if (welcomeMessage.IsEmpty())
            {
                throw new EntityNotFoundException($"Unable to find a welcome message for {type}", type.ToString());
            }

            return(welcomeMessage);
        }
        private WelcomeMessage UpdateWelcomeMessage(ColidType type, string content)
        {
            Guard.IsNotEmpty(content);

            var welcomeMessage = GetWelcomeMessage(type);

            welcomeMessage.Content = content;
            Update(welcomeMessage);
            Save();

            _cache.Delete(type.ToString());

            return(welcomeMessage);
        }
示例#4
0
 public WelcomeMessageBuilder WithType(ColidType value)
 {
     _entity.Type = value;
     return(this);
 }
 private WelcomeMessage GetWelcomeMessage(ColidType type)
 {
     return(_cache.GetOrAdd(type.ToString(), () => GetOne(wm => wm.Type.Equals(type))));
 }
 private WelcomeMessage GetWelcomeMessage(ColidType type)
 {
     return(_cache.GetOrAdd(type.ToString(), () => _wmRepo.GetOne(type)));
 }