public bool DuplicationChecking(TermStyle entity, string name) { var example = Activator.CreateInstance(entity.GetType()).As <TermStyle>(); example.Name = name; var count = _termStyleRepository.Count(example); return(0 < count); }
public bool DuplicationChecking(Entity entity, string name) { var example = Activator.CreateInstance(entity.GetType()).As <TermStyle>(); example.Name = name; var count = _termStyleRepository.Count(example); if (entity.IsNew()) { return(0 < count); } else { if (entity.Name == name && 1 == count) { return(false); } return(0 < count); } }