Exemplo n.º 1
0
        public async Task <bool> ValidateId(CustomerType CustomerType)
        {
            CustomerTypeFilter CustomerTypeFilter = new CustomerTypeFilter
            {
                Skip = 0,
                Take = 10,
                Id   = new IdFilter {
                    Equal = CustomerType.Id
                },
                Selects = CustomerTypeSelect.Id
            };

            int count = await UOW.CustomerTypeRepository.Count(CustomerTypeFilter);

            if (count == 0)
            {
                CustomerType.AddError(nameof(CustomerTypeValidator), nameof(CustomerType.Id), ErrorCode.IdNotExisted);
            }
            return(count == 1);
        }