示例#1
0
        public async Task <ActionResult <Drug> > DeleteDrug(int id)
        {
            var itExists = await _drugRepository.ItExists(id);

            if (!itExists)
            {
                return(NotFound());
            }
            var drug = await _drugRepository.FindById(id);

            var isSuccess = await _drugRepository.Delete(drug);

            if (!isSuccess)
            {
                return(InternalError($"Drug delete failed"));
            }
            return(NoContent());
        }