public Result <bool> AddPhone(GroupPhone groupPhone, string number)
        {
            var errors = new List <string>();

            if (Phones.Any(phone => phone.Number.Equals(number, StringComparison.OrdinalIgnoreCase)))
            {
                errors.Add("This number already exists");
            }

            if (errors.Any())
            {
                return(Result <bool> .Fail(errors));
            }

            var result = Phone.Create(groupPhone, number);

            PhoneInternal.Add(result.Value);
            return(Result <bool> .Success(true));
        }
Пример #2
0
 public Result <bool> AddPhone(Phone phone)
 {
     PhoneInternal.Add(phone);
     return(Result <bool> .Success(true));
 }