Пример #1
0
        public async Task<ActionResult<List<PersonPosition>>> AddPositions(Guid id, List<PersonDTO> people, CancellationToken ct = default)
        {
            try
            {
                var timestamp = DateTime.UtcNow;
                var room = await _roomService.GetRoomByIdAsync(id, ct);

                if (room.IsNull())
                    return NotFound();

                await _personPositionService.AddPeoplePositionsAsync(room, people, timestamp, ct);
                await _alarmService.CheckAlarmsAsync(room, people, ct);

                return Ok(timestamp);
            }
            catch (Exception e)
            {
                _logger.LogError(e, "Exception running {Controller} {Action}",
                   "Room", "Index");
                return new StatusCodeResult(StatusCodes.Status500InternalServerError);
            }
        }