コード例 #1
0
        public async Task <ProgressResponse> DeleteAsync(int id)
        {
            var existingProgress = await _progressRepository.FindById(id);

            if (existingProgress == null)
            {
                return(new ProgressResponse("Progress not found"));
            }

            try
            {
                _progressRepository.Remove(existingProgress);
                await _unitOfWork.CompleteAsync();

                return(new ProgressResponse(existingProgress));
            }
            catch (Exception ex)
            {
                return(new ProgressResponse($"An error ocurred while deleting progress: {ex.Message}"));
            }
        }