private async Task FindOutIds(SaleCoreModel sale) { if (await Customers.DoesCustomerExistAsync(sale.Customer).ConfigureAwait(false)) { sale.Customer.Id = await Customers.GetIdAsync(sale.Customer.FirstName, sale.Customer.LastName) .ConfigureAwait(false); } else { ThrowArgumentException("There is no such Customer. Register it!"); } if (await Managers.DoesManagerExistAsync(sale.Manager)) { sale.Manager.Id = await Managers.GetIdAsync(sale.Manager.LastName).ConfigureAwait(false); } else { ThrowArgumentException("There is no such Manager. Register it!"); } if (await Products.DoesProductExistAsync(sale.Product)) { sale.Product.Id = await Products.GetIdAsync(sale.Product.Name).ConfigureAwait(false); } else { ThrowArgumentException("There is no such Product. Register it!"); } }
private async Task FindOutIds(SaleDTO sale) { if (await Clients.DoesClientExistAsync(sale.Clients).ConfigureAwait(false)) { sale.Clients.ID = await Clients.GetIdAsync(sale.Clients.Name, sale.Clients.Surname) .ConfigureAwait(false); } else { ThrowArgumentException("There is no such Client. Register it!"); } if (await Managers.DoesManagerExistAsync(sale.Managers)) { sale.Managers.ID = await Managers.GetIdAsync(sale.Managers.Surname).ConfigureAwait(false); } else { ThrowArgumentException("There is no such Manager. Register it!"); } if (await Products.DoesProductExistAsync(sale.Products)) { sale.Products.ID = await Products.GetIdAsync(sale.Products.Name).ConfigureAwait(false); } else { ThrowArgumentException("There is no such Product. Register it!"); } }
private async Task FindOutIds(SaleDTO sale) { if (await Clients.DoesClientExistAsync(sale.Clients).ConfigureAwait(false)) { sale.Clients.ID = await Clients.GetIdAsync(sale.Clients.Name, sale.Clients.Surname) .ConfigureAwait(false); } else { ThrowArgumentException("Client not found"); } if (await Managers.DoesManagerExistAsync(sale.Managers)) { sale.Managers.ID = await Managers.GetIdAsync(sale.Managers.Surname).ConfigureAwait(false); } else { ThrowArgumentException("Mfnfger not found"); } if (await Products.DoesProductExistAsync(sale.Products)) { sale.Products.ID = await Products.GetIdAsync(sale.Products.Name).ConfigureAwait(false); } else { ThrowArgumentException("Product not found"); } }