Exemple #1
0
        public async Task <PeripheralResponse> DeleteAsync(int id)
        {
            var peripheral = await _repo.FindByIDAsync(id);

            if (peripheral == null)
            {
                return(new PeripheralResponse($"An error ocurred triying to delete the Peripheral Device : Peripheral Device not found."));
            }

            try
            {
                _repo.RemoveAsync(peripheral);
                await _unitOfWork.CompleteTask();

                return(new PeripheralResponse(peripheral));
            }
            catch (Exception ex)
            {
                return(new PeripheralResponse($"An error ocurred triying to delete the Peripheral Device : {ex.Message}"));
            }
        }