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))); }
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); }
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 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))); }