Adding User Controller and Delete endpoint

This commit is contained in:
hz
2025-05-13 21:42:17 -05:00
parent a923dfadc2
commit 98cb301acd
2 changed files with 46 additions and 0 deletions
+6
View File
@@ -23,6 +23,12 @@ public class UserService
public async Task<List<User>> GetAllAsync() =>
await _users.Find(_ => true).ToListAsync();
public async Task<bool> DeleteAsync(string username)
{
var result = await _users.DeleteOneAsync(u => u.Username == username);
return result.DeletedCount > 0;
}
public async Task CreateAsync(User user) =>
await _users.InsertOneAsync(user);