Exemplo n.º 1
0
        public async Task DeleteAsync(Guid id)
        {
            var medication = await _medicationLoader.GetByIdAsync(id);

            if (medication == null)
            {
                throw new NotFoundException($"The medication with Id '{id}' was not found.");
            }
            await _medicationRepository.DeleteAsync(medication);
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Delete(int id)
        {
            var status = await _meRepo.DeleteAsync(SD.MedicationAPIPath, id, HttpContext.Session.GetString("JWToken"));

            if (status)
            {
                return(Json(new { success = true, message = "Delete Successful" }));
            }
            return(Json(new { success = false, message = "Delete Not Successful" }));
        }
Exemplo n.º 3
0
        public async Task DeleteAsync(Guid id)
        {
            var repoMedication = await medicationRepository.GetByIdAsync(id).ConfigureAwait(false);

            if (repoMedication == null)
            {
                throw new ArgumentException("Medication doesnt exists");
            }

            await medicationRepository.DeleteAsync(repoMedication).ConfigureAwait(false);
        }