public async Task <AgentModel> PutAgent() { AgentModel agent = null; using (var reader = new StreamReader(Request.Body)) { string body = reader.ReadToEnd(); agent = JsonConvert.DeserializeObject <AgentModel>(body); } // convert to standard Agent structure agent.Name = agent.Agent; await builder.SaveAgent(agent); return(agent); }
public async Task <EntityModel> PostEntity() { EntityModel entity = null; using (var reader = new StreamReader(Request.Body)) { string body = reader.ReadToEnd(); entity = JsonConvert.DeserializeObject <EntityModel>(body); } var agent = await builder.GetAgentByName(entity.Agent); entity.Id = Guid.NewGuid().ToString(); agent.Entities.Add(entity); await builder.SaveAgent(agent); return(entity); }