public IHttpActionResult UpdateIoTDeviceSystemConfiguration(int id, [FromBody] IoTDeviceSystemConfigurationModel.Format_Update dataModel)
        {
            string logForm = "Form : " + JsonConvert.SerializeObject(dataModel);
            string logAPI  = "[Patch] " + Request.RequestUri.ToString();

            if (!ModelState.IsValid || dataModel == null)
            {
                Global._appLogger.Warn(logAPI + " || Input Parameter not expected || " + logForm);
                return(Content(HttpStatusCode.BadRequest, HttpResponseFormat.InvaildData()));
            }

            try
            {
                IoTDeviceSystemConfigurationModel model = new IoTDeviceSystemConfigurationModel();
                model.Update(id, dataModel);

                return(Content(HttpStatusCode.OK, HttpResponseFormat.Success()));
            }
            catch (CDSException cdsEx)
            {
                return(Content(HttpStatusCode.BadRequest, CDSException.GetCDSErrorMessageByCode(cdsEx.ErrorId)));
            }
            catch (Exception ex)
            {
                StringBuilder logMessage = LogHelper.BuildExceptionMessage(ex);
                logMessage.AppendLine(logForm);
                Global._appLogger.Error(logAPI + logMessage);

                return(Content(HttpStatusCode.InternalServerError, ex));
            }
        }
 public IHttpActionResult GetIoTDeviceSystemConfigurationById(int id)
 {
     try
     {
         IoTDeviceSystemConfigurationModel model = new IoTDeviceSystemConfigurationModel();
         return(Content(HttpStatusCode.OK, model.GetById(id)));
     }
     catch (CDSException cdsEx)
     {
         return(Content(HttpStatusCode.BadRequest, CDSException.GetCDSErrorMessageByCode(cdsEx.ErrorId)));
     }
     catch (Exception ex)
     {
         return(Content(HttpStatusCode.InternalServerError, ex));
     }
 }
 public IHttpActionResult DeleteIoTDeviceSystemConfiguration(int id)
 {
     try
     {
         IoTDeviceSystemConfigurationModel model = new IoTDeviceSystemConfigurationModel();
         model.DeleteById(id);
         return(Content(HttpStatusCode.OK, HttpResponseFormat.Success()));
     }
     catch (CDSException cdsEx)
     {
         return(Content(HttpStatusCode.BadRequest, CDSException.GetCDSErrorMessageByCode(cdsEx.ErrorId)));
     }
     catch (Exception ex)
     {
         string        logAPI     = "[Delete] " + Request.RequestUri.ToString();
         StringBuilder logMessage = LogHelper.BuildExceptionMessage(ex);
         Global._appLogger.Error(logAPI + logMessage);
         return(Content(HttpStatusCode.InternalServerError, ex));
     }
 }
        public IHttpActionResult GetAllIoTDeviceSystemConfiguration()
        {
            IoTDeviceSystemConfigurationModel model = new IoTDeviceSystemConfigurationModel();

            return(Content(HttpStatusCode.OK, model.GetAll()));
        }