async Task <Guid> IMedicineService.Create( string commercialName, string registrationCode, bool isPrescriptionMedicine, string dosageForm, string ingredientConcentration, string packingSpecification, uint declaredPrice, Guid submittedTenantId, string certificates) { try { var medicine = new Medicine() { CommercialName = commercialName, RegistrationCode = registrationCode, IsPrescriptionMedicine = isPrescriptionMedicine, DosageForm = dosageForm, IngredientConcentration = ingredientConcentration, PackingSpecification = packingSpecification, DeclaredPrice = declaredPrice, DateCreated = DateTime.UtcNow, SubmittedTenantId = submittedTenantId, Certificates = certificates, IsApprovedByAdmin = false }; Guid newMedicineId = medicineRepository.CreateAndReturnId(medicine); var function = ethereumService.GetFunction(EthereumFunctions.AddMedicine); var transactionHash = await function.SendTransactionAsync( ethereumService.GetEthereumAccount(), new HexBigInteger(6000000), new HexBigInteger(Nethereum.Web3.Web3.Convert.ToWei(10, UnitConversion.EthUnit.Gwei)), new HexBigInteger(0), functionInput : new object[] { newMedicineId.ToString(), commercialName, registrationCode }); medicine.TransactionHash = transactionHash; medicineRepository.Update(medicine); BackgroundJob.Schedule <IMedicineBackgroundJob>( medicineBackgroundJob => medicineBackgroundJob.WaitForTransactionToSuccessThenFinishCreatingMedicine(medicine), TimeSpan.FromSeconds(3) ); return(newMedicineId); } catch (Exception ex) { throw ex; } }