public static PersistEvent ( object ev ) : void | ||
ev | object | |
return | void |
public static void PersistEvent(object ev)
{
var commitHeaders = new Dictionary<string, object>
{
{"CommitId", Guid.NewGuid()},
};
esConn.AppendToStream(
"BeganFollowing", ExpectedVersion.Any, ToEventData(Guid.NewGuid(),
ev, commitHeaders
));
}
[ActionName("index")] // Web API will not allow duplicate names public IHttpActionResult IndexPOST(string accountId, Follower follower) { // accountId will be taken from querystring - it is a simple type // follower will be taken from request body - it is a complex type var evnt = new BeganFollowing { AccountId = accountId, FollowerId = follower.AccountId }; EventPersister.PersistEvent(evnt); return(RedirectToRoute("Account Followers", new { accountId = accountId })); }