示例#1
0
        public async Task <bool> ValidateId(Stock Stock)
        {
            StockFilter StockFilter = new StockFilter
            {
                Skip = 0,
                Take = 10,
                Id   = new LongFilter {
                    Equal = Stock.Id
                },
                Selects = StockSelect.Id
            };

            int count = await UOW.StockRepository.Count(StockFilter);

            if (count == 0)
            {
                Stock.AddError(nameof(StockValidator), nameof(Stock.Id), ErrorCode.IdNotExisted);
            }

            return(count == 1);
        }