Exemplo n.º 1
0
        public async Task <DocResponse> DeleteAsync(int id)
        {
            var existingDoc = await _docRepository.FindByIdAsync(id);

            if (existingDoc == null)
            {
                return(new DocResponse("Doc not found."));
            }

            try
            {
                _docRepository.Remove(existingDoc);
                await _unitOfWork.CompleteAsync();

                return(new DocResponse(existingDoc));
            }
            catch (Exception ex)
            {
                return(new DocResponse($"An error occurred when deleting the doc: {ex.Message}"));
            }
        }
Exemplo n.º 2
0
        public void Delete(string id)
        {
            var cliente = repository.GetId(id);

            repository.Remove(cliente);
        }