Esempio n. 1
0
        public async Task <IActionResult> DeleteGateway([FromRoute] string SerialNumber)
        {
            if (!await _context.GatewayExists(SerialNumber))
            {
                _logger.LogError($"Gateway with serial number {SerialNumber} wasn't found!");
                return(NotFound($"Gateway with serial number {SerialNumber} wasn't found!"));
            }
            try
            {
                await _context.DeleteGateway(SerialNumber);

                return(Ok());
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message, ex);
                return(StatusCode(500, "A problem happened while handling you request."));
            }
        }