コード例 #1
0
        public async Task <IHttpActionResult> Logout([FromBody] Dictionary <string, string> @param)
        {
            var user = await _userProfileService.FindByUserIdAsync(_userProfileService.CurrentUserId);

            var events = new SignalREventHandlers(@param["token"]);
            await events.TriggerUserActivitiesAsync(new UserActivitiesArgs
            {
                Action = ActionType.Logout,
                Name   = user.FullName
            });

            return(Content(System.Net.HttpStatusCode.OK, "Successful"));
        }
コード例 #2
0
        public async Task <IHttpActionResult> Post([FromBody] Dictionary <string, string> @param)
        {
            var result = await _proxyService.EnsureApiTokenAsync(@param["username"], @param["password"]);

            if (result.ContainsKey("fullName"))
            {
                var events = new SignalREventHandlers(result["access_token"]);
                await events.TriggerUserActivitiesAsync(new UserActivitiesArgs
                {
                    Action = ActionType.Login,
                    Name   = result["fullName"],
                });
            }

            return(Ok(result));
        }