protected override void DoPut(CoapExchange exchange) { WLANConnectivityResource wLANConnectivityResource = WLANConnectivityResource.Deserialise(exchange.Request); if (wLANConnectivityResource == null) { Response response = Response.CreateResponse(exchange.Request, StatusCode.BadRequest); exchange.Respond(response); } else { wLANConnectivityResource.Name = this.GetNextChildName(); this.Add(wLANConnectivityResource); Response response = Response.CreateResponse(exchange.Request, StatusCode.Changed); exchange.Respond(response); OnChildCreated(wLANConnectivityResource); } }
protected override void DoPost(CoapExchange exchange) { WLANConnectivityResource wLANConnectivityResource = WLANConnectivityResource.Deserialise(exchange.Request); if (wLANConnectivityResource == null) { Response response = Response.CreateResponse(exchange.Request, StatusCode.BadRequest); exchange.Respond(response); } else { wLANConnectivityResource.Name = this.GetNextChildName(); this.Add(wLANConnectivityResource); Response response = Response.CreateResponse(exchange.Request, StatusCode.Created); response.AddOption(Option.Create(OptionType.LocationPath, string.Concat(wLANConnectivityResource.Path, wLANConnectivityResource.Name))); exchange.Respond(response); OnChildCreated(wLANConnectivityResource); } }