public HttpStatusCode deleteNotification(string id) // convert to json { var response = new HttpResponseMessage(); HttpStatusCode res; try { int _id = JsonSerializer.Deserialize <int>(id); bool idExists = _stockScreenerService.NotificationsIdExists(_id); if (idExists) { _stockScreenerService.Remove(_id); Console.WriteLine("id " + _id); } else { return(HttpStatusCode.Ambiguous); } res = response.StatusCode; } catch (Exception ex) { if (ex is System.ArgumentNullException) { Console.WriteLine("Exception " + ex); } Console.WriteLine("Exception " + ex); res = response.StatusCode; } return(res); }