Example #1
0
        public async Task <bool> ValidateId(UnitOfMeasure UnitOfMeasure)
        {
            UnitOfMeasureFilter UnitOfMeasureFilter = new UnitOfMeasureFilter
            {
                Skip = 0,
                Take = 10,
                Id   = new IdFilter {
                    Equal = UnitOfMeasure.Id
                },
                Selects = UnitOfMeasureSelect.Id
            };

            int count = await UOW.UnitOfMeasureRepository.Count(UnitOfMeasureFilter);

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