Esempio n. 1
0
        public async Task NewLine(string roomId, LineDto line)
        {
            if (line == null)
            {
                return;
            }
            Clients.GroupExcept(roomId, new[] { Context.ConnectionId })
            .SendAsync(RoomHubEvents.NewLine, line);
            var newLine = new Line {
                Value = new List <Coordinate>(), Color = line.Color
            };

            for (var i = 0; i < line.Coordinates.Length; i++)
            {
                newLine.Value.Add(new Coordinate {
                    Value = line.Coordinates[i], SerialNumber = i
                });
            }
            roomRepository.AddLineToFieldIntoRoom(int.Parse(roomId), newLine);
        }