示例#1
0
        [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 });
        }
        [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 }));
        }