public IHttpActionResult AttachNotification(int id, [FromBody] AlarmNotificationModels.Edit alarmNotification) { JavaScriptSerializer js = new JavaScriptSerializer(); string logForm = "Form : " + js.Serialize(alarmNotification); string logAPI = "[Put] " + Request.RequestUri.ToString(); if (!ModelState.IsValid) { Startup._sfAppLogger.Warn(logAPI + " || Input Parameter not expected || " + logForm); return(BadRequest("Invalid data")); } try { AlarmNotificationModels alarmRuleCatalogModel = new AlarmNotificationModels(); alarmRuleCatalogModel.AttachExternalApplication(id, alarmNotification); return(Ok("Success")); } catch (Exception ex) { StringBuilder logMessage = LogUtility.BuildExceptionMessage(ex); logMessage.AppendLine(logForm); Startup._sfAppLogger.Error(logAPI + logMessage); return(InternalServerError(ex)); } }
public IHttpActionResult GetAllNotification(int id) { AlarmNotificationModels alarmNotificationModel = new AlarmNotificationModels(); return(Ok(alarmNotificationModel.GetAllExternalApplicationByAlarmRuleCatalogId(id))); }