Пример #1
0
        public async Task <TerminalResponse> DeleteAsync(int id)
        {
            var existingTerminal = await _terminalRepository.FindById(id);

            if (existingTerminal == null)
            {
                return(new TerminalResponse("Terminal not found"));
            }
            try
            {
                _terminalRepository.Remove(existingTerminal);
                await _unitOfWork.CompleteAsync();

                return(new TerminalResponse(existingTerminal));
            }
            catch (Exception e)
            {
                return(new TerminalResponse($"An error ocurred while deleting the terminal: {e.Message}"));
            }
        }