Moved implementation of check for existance of username on creating user from user service to repository.

This commit is contained in:
Andy Butland
2020-02-15 09:20:59 +01:00
parent 54af158012
commit 1f8d4b1db7
3 changed files with 33 additions and 2 deletions

View File

@@ -626,6 +626,11 @@ ORDER BY colName";
}
public bool Exists(string username)
{
return ExistsByUserName(username);
}
public bool ExistsByUserName(string username)
{
var sql = SqlContext.Sql()
.SelectCount()
@@ -635,6 +640,16 @@ ORDER BY colName";
return Database.ExecuteScalar<int>(sql) > 0;
}
public bool ExistsByLogin(string login)
{
var sql = SqlContext.Sql()
.SelectCount()
.From<UserDto>()
.Where<UserDto>(x => x.Login == login);
return Database.ExecuteScalar<int>(sql) > 0;
}
/// <summary>
/// Gets a list of <see cref="IUser"/> objects associated with a given group
/// </summary>