/// <summary> /// Retireve all Characters for the given Account /// </summary> public ICollection<Character> GetByAccount(Account account) { return m_characters.Where(m => m.Account.AccountId == account.AccountId) .OrderByDescending(m => m.Active) .ThenBy(m => m.Name) .ToList(); }
/// <summary> /// Insert a new Account /// </summary> public Account Insert(Account account) { // hash the given password account.Password = GetPasswordHash(account.Password); return m_accounts.Add(account); }
/// <summary> /// Insert a new Account /// </summary> public Account Insert(Account account) { // hash the given password account.Password = GetPasswordHash(account.Password); // validate the new account var validator = new AccountValidator(m_accounts); var validationresults = validator.Validate(account, ruleSet: "default,Insert"); if (!validationresults.IsValid) throw new ValidationException(validationresults.Errors); return m_accounts.Insert(account); }