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}"); } }
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}"); } } }
private Task <Buyer> GetBy(IBuyerContainer departmentContainer) { return(this.BuyerDataAccess.GetByAsync(departmentContainer)); }
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); }