public async Task Validate(Habitant habitant)
 {
     if (!await ExistHabitantAsync(habitant).ConfigureAwait(false))
     {
         habitant.AddBrokenRule("Habitant not found");
         habitant.Validate("Can not delete habitant");
     }
 }
示例#2
0
        public async Task Validate(Habitant habitant)
        {
            if (await ExistHabitantWithNameAsync(habitant.Name).ConfigureAwait(false))
            {
                habitant.AddBrokenRule("Habitant with the same name found");
            }

            await CheckCommonDataForUpdateAndInsert(habitant);

            habitant.Validate("Can not create habitant");
        }