Esempio n. 1
0
        public static Result <AbonentGroup> Create(Abonent abonent, Group group)
        {
            var errors = new List <string>();

            if (abonent is null)
            {
                errors.Add(nameof(abonent));
            }
            if (group is null)
            {
                errors.Add(nameof(group));
            }

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

            var newAbonentGroup = new AbonentGroup
            {
                Group     = group,
                GroupId   = group.Id,
                Abonent   = abonent,
                AbonentId = abonent.Id
            };

            return(Result <AbonentGroup> .Success(newAbonentGroup));
        }
 public Result <bool> AddAbonentGroup(AbonentGroup abonentGroup)
 {
     GroupInternal.Add(abonentGroup);
     return(Result <bool> .Success(true));
 }