Beispiel #1
0
    public Result CreateUser(User user)
    {
        FileContent content = _persister.ReadFileContent(DbConstants.userFileName);

        Maybe <FileOperation> createUserOperation = _userDatabaseManager.AddUser(content, user);

        if (createUserOperation.HasValue)
        {
            _persister.ApplyChanges(createUserOperation.Value);
            return(Result.Ok());
        }

        return(Result.Fail("User already exists."));
    }