Exemplo n.º 1
0
 public async Task Feed(UpdatePersonState newPersonState)
 {
     log.DebugFormat("got person state {0}", newPersonState == null ? "null" : newPersonState.ToString());
     if (newPersonState == null) throw new ArgumentNullException("newPersonState");
     Task.Run(() => stateStore.UpdatePersonState(newPersonState.Realm, newPersonState.Group, newPersonState.Location, CreatePerson(newPersonState.MemberState)));
 }
Exemplo n.º 2
0
        public async Task<IHttpActionResult> Put(string name, [FromBody]PersonState value)
        {
            var identity = this.GetFeederIdentity();
            if (!validateIdentity(identity)) return Unauthorized();
            if (!validateState(value)) return BadRequest();

            var feed = new UpdatePersonState()
            {
                Realm = identity.Realm,
                Group = identity.Group,
                Location = identity.Location,
                MemberState = value
            };

            await Task.Run(() => { log.DebugFormat("Feeding person state {0}", feed); stateFeed.Feed(feed); });
            return Ok();
        }