예제 #1
0
        public async Task <AllergyResponse> DeleteAsync(int id)
        {
            var existingPlan = await _allergyRepository.FindById(id);

            if (existingPlan == null)
            {
                return(new AllergyResponse("Plan not found"));
            }

            try
            {
                _allergyRepository.DeleteAsync(existingPlan);
                await _unitOfWork.CompleteAsync();

                return(new AllergyResponse(existingPlan));
            }
            catch (Exception e)
            {
                return(new AllergyResponse($"An error ocurred while deleting plan: {e.Message}"));
            }
        }