public async Task <IActionResult> DeleteMedicine([FromRoute] int id) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var medicine = await _medicineRepository.FindAsync(id); if (medicine == null) { return(NotFound()); } _medicineRepository.Delete(medicine); await _medicineRepository.SaveChangesAsync(); return(Ok(medicine)); }
async Task IMedicineService.Delete(Guid id) { var medicine = medicineRepository.Get(id); if (medicine == null) { throw new ArgumentException("Id does not exist in the system.", nameof(id)); } try { var function = ethereumService.GetFunction(EthereumFunctions.RemoveMedicine); var transactionHash = await function.SendTransactionAsync( ethereumService.GetEthereumAccount(), new HexBigInteger(1000000), new HexBigInteger(0), functionInput : new object[] { id.ToString() }); var contract = ethereumService.GetContract(MedicineAbi, medicine.ContractAddress); var deleteFunction = ethereumService.GetFunction(contract, EthereumFunctions.SelfDelete); var receipt = await deleteFunction.SendTransactionAsync( ethereumService.GetEthereumAccount(), new HexBigInteger(6000000), new HexBigInteger(Nethereum.Web3.Web3.Convert.ToWei(5, UnitConversion.EthUnit.Gwei)), new HexBigInteger(0), functionInput : new object[] { } ); medicineRepository.Delete(id); } catch (Exception ex) { throw ex; } }
public bool DeleteMedicine(MedicineDto medicine) { var entity = _DtoMapper.Map(medicine); return(_MedicineRepository.Delete(entity)); }
public bool DeleteMedicine(int medicineId) { return(_medicineRepository.Delete(medicineId)); }
public void DeleteMedicine(long id) { var Medicine = _repo.Find(id); _repo.Delete(Medicine); }
public async Task <bool> Delete(int id) { var success = await _repository.Delete(id); return(success); }
public void Delete(Medicine medicine) { DeleteFilesForGivenId(medicine.Id); _repository.Delete(medicine); }
public void Delete(int idSelected) { _repository.Delete(idSelected); }
public bool DeleteMedicine(MedicineDTO medicine) { var entity = _DTOMappers.Map(medicine); return(_medicineRepository.Delete(entity)); }
private void Med_Delete_Product_Click(object sender, EventArgs e) { medRepos.Delete((int)dataGridView1.CurrentCell.Value); Clear_Table(this.dataGridView1); Load_Med_Table(this.dataGridView1); }