public async Task <BeaconV1> CreateBeaconAsync(string correlationId, BeaconV1 beacon) { beacon.Id = beacon.Id ?? IdGenerator.NextLong(); beacon.Type = beacon.Type ?? BeaconTypeV1.Unknown; return(await _persistence.CreateAsync(correlationId, beacon)); }
public async Task <BeaconV1> UpdateBeaconAsync(string correlationId, BeaconV1 beacon) { using (Instrument(correlationId, "beacons.update_beacon")) { return(await _controller.UpdateBeaconAsync(correlationId, beacon)); } }
public async Task <BeaconV1> UpdateAsync(string correlationId, BeaconV1 beacon) { return(await SafeInvokeAsync(correlationId, "UpdateAsync", () => { return _Persistence.UpdateAsync(correlationId, beacon); })); }
private static BeaconsMongoDbSchema FromPublic(BeaconV1 val) { var config = new MapperConfiguration(cfg => cfg.CreateMap <BeaconV1, BeaconsMongoDbSchema>()); var mapper = config.CreateMapper(); BeaconsMongoDbSchema result = mapper.Map <BeaconsMongoDbSchema>(val); return(result); }
public static void AssertEqual(BeaconV1 expectedBeacon, BeaconV1 actualBeacon) { Assert.Equal(expectedBeacon.Id, actualBeacon.Id); Assert.Equal(expectedBeacon.SiteId, actualBeacon.SiteId); Assert.Equal(expectedBeacon.Type, actualBeacon.Type); Assert.Equal(expectedBeacon.Udi, actualBeacon.Udi); Assert.Equal(expectedBeacon.Label, actualBeacon.Label); Assert.Equal(expectedBeacon.Center, actualBeacon.Center); Assert.Equal(expectedBeacon.Radius, actualBeacon.Radius); }
public async Task <BeaconV1> UpdateBeaconAsync(string correlationId, BeaconV1 beacon) { return(await CallCommandAsync <BeaconV1>( "update_beacon", correlationId, new { beacon = beacon } )); }
public async Task <BeaconV1> CreateBeaconAsync(string correlationId, BeaconV1 beacon) { return(await CallCommandAsync <BeaconV1>( "create_beacon", correlationId ?? IdGenerator.NextLong(), new { beacon = beacon } )); }
public async Task <BeaconV1> CreateBeaconAsync(string correlationId, BeaconV1 beacon) { if (beacon == null) { return(null); } beacon.Id = beacon.Id ?? IdGenerator.NextLong(); _items.Add(beacon); return(await Task.FromResult(beacon)); }
private BeaconV1 ToPublic(BeaconsMongoDbSchema val) { if (val == null) { return(null); } var config = new MapperConfiguration(cfg => cfg.CreateMap <BeaconsMongoDbSchema, BeaconV1>()); var mapper = config.CreateMapper(); BeaconV1 result = mapper.Map <BeaconV1>(val); return(result); }
public async Task <BeaconV1> UpdateBeaconAsync(string correlationId, BeaconV1 beacon) { var index = _items.FindIndex(el => el.Id == beacon.Id); if (index < 0) { return(null); } _items[index] = beacon; return(await Task.FromResult(beacon)); }
public async Task <BeaconV1> CreateBeaconAsync(string correlationId, BeaconV1 beacon) { var methodName = "beacons.create_beacon"; try { using (Instrument(correlationId, methodName)) { return(await _controller.CreateBeaconAsync(correlationId, beacon)); } } catch (Exception ex) { InstrumentError(correlationId, methodName, ex); throw ex; } }
public async Task <BeaconV1> UpdateBeaconAsync(string correlationId, BeaconV1 beacon) { beacon.Type = beacon.Type ?? BeaconTypeV1.Unknown; return(await _persistence.UpdateAsync(correlationId, beacon)); }
public async Task <BeaconV1> UpdateAsync(string correlationId, BeaconV1 beacon) { var result = await UpdateAsync(correlationId, FromPublic(beacon)); return(ToPublic(result)); }
public async Task <BeaconV1> UpdateBeaconAsync(string correlationId, BeaconV1 beacon) { return(await Task.FromResult(new BeaconV1())); }
public async Task <BeaconV1> CreateBeaconAsync(string correlationId, BeaconV1 beacon) { return(await Task.FromResult <BeaconV1>(null)); }