Exemple #1
0
        public async Task <IActionResult> Create(Movement movement)
        {
            int success = await _movementService.AddMovementAsync(movement);

            if (success < 0)
            {
                return(NotFound());
            }

            return(RedirectToAction("Index"));
        }
Exemple #2
0
        public async Task <IActionResult> AddMovementRecord([FromBody] MovementChangedData movementData)
        {
            if (movementData == null || !ModelState.IsValid)
            {
                return(new BadRequestObjectResult(ModelState));
            }

            Console.WriteLine($"{DateTime.UtcNow} Received movement change from {movementData.DeviceId}");

            await _movementsService.AddMovementAsync(movementData);

            return(Accepted());
        }