public HomeController(IIncidentData incidentData, ILogger <HomeController> logger, AdminAlert adminAlert) { _adminAlert = adminAlert; _logger = logger; _incidentData = incidentData; }
// POST: api/AdminAlert public HttpResponseMessage Post([FromBody] string value) { System.Diagnostics.Debug.WriteLine("Alert " + value); AdminAlert adminAlert = JsonConvert.DeserializeObject <AdminAlert>(value); bool result = new AdminAlertDAO().AddAdminAlert(adminAlert); if (result) { HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, adminAlert); response.Headers.Location = new Uri(Request.RequestUri, string.Format("AdminAlert/{0}", adminAlert.Id)); return(response); } else { HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Conflict, adminAlert); return(response); } }