public MedicineDTO CreateMedicine([FromBody] MedicineDTO medicine) { Medicine medicineEntity = _mapper.Map <Medicine>(medicine); _repository.CreateMedicine(medicineEntity); _repository.Save(); MedicineDTO newMedicine = _mapper.Map <MedicineDTO>(medicineEntity); return(newMedicine); }
public async Task <Medicine> CreateMedicine(Medicine medicine, int[] SubstanceIds) { var test = await medicineFunctions.CodeControl(medicine.Code); return(test ? throw new Exception("Code Mevcuttur") : await medicineRepository.CreateMedicine(medicine, SubstanceIds)); }