diff options
author | crupest <crupest@outlook.com> | 2020-11-26 20:02:03 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-11-26 20:02:03 +0800 |
commit | 60cf54d80e62ea9180660e5a951c569f90bc4636 (patch) | |
tree | c2ce11354fafdd4ac0bbe4b2fe13be221aac8eac /BackEnd/Timeline/Services/UserService.cs | |
parent | b4f2e1d53836998f7a5c0f73638ea4a56a970a1a (diff) | |
download | timeline-60cf54d80e62ea9180660e5a951c569f90bc4636.tar.gz timeline-60cf54d80e62ea9180660e5a951c569f90bc4636.tar.bz2 timeline-60cf54d80e62ea9180660e5a951c569f90bc4636.zip |
feat: Add highlight timeline entity and service.
Diffstat (limited to 'BackEnd/Timeline/Services/UserService.cs')
-rw-r--r-- | BackEnd/Timeline/Services/UserService.cs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/BackEnd/Timeline/Services/UserService.cs b/BackEnd/Timeline/Services/UserService.cs index 2c5644cd..76c24666 100644 --- a/BackEnd/Timeline/Services/UserService.cs +++ b/BackEnd/Timeline/Services/UserService.cs @@ -39,6 +39,13 @@ namespace Timeline.Services Task<User> VerifyCredential(string username, string password);
/// <summary>
+ /// Check if a user exists.
+ /// </summary>
+ /// <param name="id">The id of the user.</param>
+ /// <returns>True if exists. Otherwise false.</returns>
+ Task<bool> CheckUserExistence(long id);
+
+ /// <summary>
/// Try to get a user by id.
/// </summary>
/// <param name="id">The id of the user.</param>
@@ -188,6 +195,11 @@ namespace Timeline.Services return await CreateUserFromEntity(entity);
}
+ public async Task<bool> CheckUserExistence(long id)
+ {
+ return await _databaseContext.Users.AnyAsync(u => u.Id == id);
+ }
+
public async Task<User> GetUser(long id)
{
var user = await _databaseContext.Users.Where(u => u.Id == id).SingleOrDefaultAsync();
|