public ResponseSerializer Create([FromBody] ThresholdSerializer thresholdSerializer)
 {
     return(new ResponseSerializer(
                200,
                "success",
                this._thresholdBus.InsertThreshold(thresholdSerializer)));
 }
Example #2
0
 public ResponseSerializer Put(int id, [FromBody] ThresholdSerializer thresholdSerializer)
 {
     return(new ResponseSerializer(
                200,
                "success",
                this._thresholdBus.UpdateThreshold(id, thresholdSerializer)));
 }
        public String InsertThreshold(ThresholdSerializer thresholdSerializer)
        {
            ThresholdModel t = new ThresholdModel();

            t.IndexId        = thresholdSerializer.field;
            t.DeviceId       = thresholdSerializer.deviceGroup;
            t.Operator       = thresholdSerializer.Operator;
            t.ThresholdValue = int.Parse(thresholdSerializer.value);
            t.RuleName       = thresholdSerializer.name;
            t.Description    = thresholdSerializer.description;
            t.Severity       = thresholdSerializer.severity;
            return(this._thresholdDao.Create(t));
        }
Example #4
0
        public String UpdateThreshold(int id, ThresholdSerializer thresholdSerializer)
        {
            ThresholdModel t = new ThresholdModel();

            t.IndexId        = thresholdSerializer.field;
            t.DeviceId       = thresholdSerializer.deviceGroup;
            t.Operator       = thresholdSerializer.Operator;
            t.ThresholdValue = double.Parse(thresholdSerializer.value);
            t.RuleName       = thresholdSerializer.name;
            t.Description    = thresholdSerializer.description;
            t.Severity       = thresholdSerializer.severity;
            t.UpdateTime     = DateTime.Now;
            return(this._thresholdDao.Update(id, t));
        }