in Lab/Exercise3/02-End/Contoso.WebAPI/Controllers/PushController.cs [35:51]
public ActionResult SaveChannel(Subscription subscription)
{
using (var db = new LiteDatabase(databasePath))
{
PushChannel channel = new PushChannel
{
ChannelUri = subscription.DeviceSubscription.Endpoint.ToString(),
P256Dh = subscription.DeviceSubscription.Keys.P256Dh,
Auth = subscription.DeviceSubscription.Keys.Auth
};
var channels = db.GetCollection<PushChannel>();
channels.Insert(channel);
return new OkResult();
}
}