private bool UniqueName(string userName) { try { var spec = new UserWithNameExistsSpec(userName); return(!_ufw.Repository <User>() .Any(spec)); } catch { return(false); } }
private bool UniqueName(UserUpdateDto model) { try { var notWithCurId = new UserWithIdExistsSpec(model.Id).Not(); var spec = new UserWithNameExistsSpec(model.UserName).And(notWithCurId); return(!_ufw.Repository <User>() .Any(spec)); } catch (Exception) { return(false); } }