Exemplo n.º 1
0
        public async Task <ActionResult <MonitoringPoint> > PostMonitoringPoint(MonitoringPoint monitoringPoint)
        {
            _context.MonitoringPoints.Add(monitoringPoint);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetMonitoringPoint", new { id = monitoringPoint.id }, monitoringPoint));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> PutMonitoringPoint(int id, MonitoringPoint monitoringPoint)
        {
            if (id != monitoringPoint.id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }