public async Task PutEndpointInfo(string endpoint, EndpointAdvertising dto) { var data = await db.Endpoints.FindAsync(endpoint); if (data == null) { data = new Endpoint { Id = endpoint }; db.Endpoints.Add(data); } data.FromDto(dto); await db.SaveChangesAsync(); }
public static void FromDto(this Endpoint endpoint, EndpointAdvertising data) { endpoint.Name = data.name; endpoint.GameModes = data.gameModes == null ? null : string.Join(",", data.gameModes); }