コード例 #1
0
        public async Task ValidateAsync(IBuyerContainer buyerContainer)
        {
            if (buyerContainer == null)
            {
                throw new ArgumentNullException(nameof(buyerContainer));
            }

            var tights = await this.GetBy(buyerContainer);

            if (buyerContainer.BuyerId.HasValue && tights == null)
            {
                throw new InvalidOperationException($"Tights not found by id {buyerContainer.BuyerId}");
            }
        }
コード例 #2
0
        public async Task ValidateAsync(IBuyerContainer BuyerContainer)
        {
            if (BuyerContainer == null)
            {
                throw new ArgumentNullException(nameof(BuyerContainer));
            }
            if (BuyerContainer.BuyerId.HasValue)
            {
                var department = await this.BuyerDAL.GetAsync(new BuyerIdentityModel(BuyerContainer.BuyerId.Value));

                if (department == null)
                {
                    throw new InvalidOperationException($"Department not found by id {BuyerContainer.BuyerId}");
                }
            }
        }
コード例 #3
0
 private Task <Buyer> GetBy(IBuyerContainer departmentContainer)
 {
     return(this.BuyerDataAccess.GetByAsync(departmentContainer));
 }
コード例 #4
0
ファイル: BuyerDataAccess.cs プロジェクト: llaponina/DOTNET
 public async Task <Buyer> GetByAsync(IBuyerContainer buyer)
 {
     return(buyer.BuyerId.HasValue
         ? this.Mapper.Map <Buyer>(await this.Context.Buyer.FirstOrDefaultAsync(x => x.Id == buyer.BuyerId))
         : null);
 }