public async Task Feed(UpdateLocationState newState) { log.DebugFormat("got location state {0}", newState == null ? "null" : newState.ToString()); if (newState == null) throw new ArgumentNullException("newState"); IEnumerable<Person> people = newState.MembersState.Select(ps => CreatePerson(ps)); Task.Run(() => stateStore.UpdateLocationState(newState.Realm, newState.Group, newState.Location, people)); }
// POST: api/State public async Task<IHttpActionResult> Post([FromBody]IEnumerable<PersonState> value) { //log.Debug("rec post"); var identity = this.GetFeederIdentity(); //log.Debug("rec post iden"); if (!validateIdentity(identity)) return Unauthorized(); //log.Debug("rec post auth"); if (!validateState(value)) return BadRequest(); //log.Debug("rec post valid"); var feed = new UpdateLocationState() { Realm = identity.Realm, Group = identity.Group, Location = identity.Location, MembersState = value }; await Task.Run(() => { log.DebugFormat("Feeding location state {0}", feed); stateFeed.Feed(feed); }); return Ok(); }