コード例 #1
0
        public async Task <EducationResponse> DeleteAsync(int id)
        {
            try
            {
                var exist = await _educationRepository.FindByIdAsync(id);

                EducationResponse response = exist == null ? new EducationResponse($"Education {id} not found") : new EducationResponse(exist);

                _educationRepository.Remove(exist);
                await _unitOfWork.CompleteAsync();

                return(response);
            }
            catch (Exception e)
            {
                return(new EducationResponse($"An error occurred when deleting the education: { e.Message }"));
            }
        }