Checkpoint: Directory Wired
Challenge on lesson: Checkpoint โ The User Directory with a Repository
CHALLENGE
Difficulty: intermediate+25 XP
Implement the directory described in the checkpoint:
``csharp
public sealed record User(string Name, decimal Balance);
public interface IUserRepository
{
string Register(string name); // "ok" | "duplicate"
Solution.User? FindByName(string name);
int Count();
}
public sealed class SqlUserRepository : IUserRepository { public SqlUserRepository(CjDb db); }
public sealed class UserService
{
public UserService(IUserRepository repo);
public string Invite(string name); // "invited:<name>" | "exists:<name>"
}
``
Press Submit to check your solution.
Back to lesson: Checkpoint โ The User Directory with a Repository