public async Task <ResponseDto> DeleteAsync(int id) { const string methodName = ClassName + "." + nameof(DeleteAsync); var response = new ResponseDto(); var getResponse = await _workRepository.GetAsync(id); if (getResponse.Success) { if (getResponse.Result != null) { var mappingResponse = _workMappingHelper.MapDeleteToEntity(new WorkDeleteRequestDto() { WorkId = id }); if (mappingResponse.Success) { var deleteResponse = await _workRepository.DeleteAsync(mappingResponse.Result.WorkId); if (deleteResponse.Success) { response.SetSuccess(); } else { response.SetError(deleteResponse.ErrorId, deleteResponse.Message, methodName, deleteResponse.ResponseType); } } else { response.SetError(mappingResponse.ErrorId, mappingResponse.Message, methodName, mappingResponse.ResponseType); } } else { response.SetError(getResponse.ErrorId, ErrorMessage.RecordNotFound, methodName, getResponse.ResponseType); } } else { response.SetError(getResponse.ErrorId, getResponse.Message, methodName, getResponse.ResponseType); } return(response); }