private async Task <Supplier> GetSupplierByName(string name, string userId) { var supplier = await _supplierRepository.GetByName(name, userId); if (supplier == null) { supplier = _supplierFactory.Create(name, userId); await _supplierRepository.Add(supplier); } return(supplier); }
public override void Execute() { TypedResult = new AddSupplierResult(); CheckIfSupplierExist(); var supplier = supplierFactory.Create(); supplier.Name = SupplierName; suppliersRepository.Add(supplier); TypedResult.Supplier = supplier; base.Execute(); }
public async Task Add(AddSupplierDto dto) { var supplier = _supplierFactory.Create(dto.Name, dto.UserId); await _supplierRepository.Add(supplier); }