public async Task <IActionResult> InProgresstIntervention(long id, Intervention intervention)
        {
            var i = await _context.interventions.FindAsync(id);

            if (i == null)
            {
                return(NotFound());
            }


            DateTime aDate = DateTime.Now;

            i.status = intervention.status;
            i.start_date_and_time_of_the_intervention = aDate;

            _context.interventions.Update(i);
            _context.SaveChanges();

            // Create a message to show the new status
            var status = new JObject();

            status["message"] = "The status of the Intervention with the id number #" + i.Id + " have been changed to " + i.status;
            return(Content(status.ToString(), "application/json"));
        }
        public async Task <IActionResult> PutElevator(long id, Elevator elevator)
        {
            var e = await _context.elevators.FindAsync(id);

            if (e == null)
            {
                return(NotFound());
            }

            e.elevator_status = elevator.elevator_status;

            _context.elevators.Update(e);
            _context.SaveChanges();

            // Create a message to show the new status
            return(Content(e.elevator_status));
        }
Beispiel #3
0
        public async Task <ActionResult> PutColumn(long id, Column column)
        {
            var c = await _context.columns.FindAsync(id);

            if (c == null)
            {
                return(NotFound());
            }

            c.column_status = column.column_status;

            _context.columns.Update(c);
            _context.SaveChanges();
            // Create a message to show the new status
            var status = new JObject();

            status["message"] = "The status of the Column with the id number #" + c.Id + " have been changed to " + c.column_status;
            return(Content(status.ToString(), "application/json"));
        }
Beispiel #4
0
        public async Task <IActionResult> PutBattery(long id, Battery battery)
        {
            var b = await _context.batteries.FindAsync(id);

            if (b == null)
            {
                return(NotFound());
            }

            b.battery_status = battery.battery_status;

            _context.batteries.Update(b);
            _context.SaveChanges();
            // Create a message to show the new status
            var status = new JObject();

            status["message"] = "The status of the Battery with the id number #" + b.Id + " have been changed to " + battery.battery_status;
            return(Content(status.ToString(), "application/json"));
        }
        public async Task <IActionResult> PutElevator(long id, Elevator elevator)
        {
            var e = await _context.elevators.FindAsync(id);

            if (e == null)
            {
                return(NotFound());
            }

            e.elevator_status = elevator.elevator_status;

            _context.elevators.Update(e);
            _context.SaveChanges();

            // Create a message to show the new status
            var status = new JObject();

            status["message"] = "The status of the Elevator with the id number #" + e.Id + " have been changed to " + e.elevator_status;
            return(Content(status.ToString(), "application/json"));
        }