Example #1
0
        public async Task <IActionResult> PutDrainPatrolAlarm(long id, DrainPatrolAlarm drainPatrolAlarm)
        {
            if (id != drainPatrolAlarm.Id)
            {
                return(BadRequest());
            }

            _context.Entry(drainPatrolAlarm).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DrainPatrolAlarmExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Example #2
0
        public async Task <ActionResult <DrainPatrolAlarm> > PostDrainPatrolAlarm(DrainPatrolAlarmViewModel drainPatrolAlarmVM)
        {
            var insertData = new DrainPatrolAlarm
            {
                Master_node = drainPatrolAlarmVM.Master_node,
                Index       = drainPatrolAlarmVM.Index,
                Address     = drainPatrolAlarmVM.Address,
                TimeStamp   = drainPatrolAlarmVM.TimeStamp,
                AlarmType   = drainPatrolAlarmVM.AlarmType,
                Amount      = drainPatrolAlarmVM.Amount,
                Limit       = drainPatrolAlarmVM.Limit
            };



            _context.DrainPatrolAlarms.Add(insertData);
            await _context.SaveChangesAsync();

            return(Ok(drainPatrolAlarmVM));
        }