Exemple #1
0
        public async Task <IHttpActionResult> DeleteUser(DeleteUserBindingModel model)
        {
            var result = new DeleteUserViewModel();

            result.Result = await _userAccess.DeleteAsync(model.Data.ID) > 0;

            if (result.Result)
            {
                var notificationHub = GetHub <NotificationHub, INotificationHub>();

                var connectionId = _requestReader.Read(HttpHeaders.Request.SignalRConnectionId);
                if (!string.IsNullOrEmpty(connectionId))
                {
                    notificationHub.Clients.AllExcept(connectionId).UpdateModel(new NotificationModel()
                    {
                        Username = UserName,
                        Action   = string.Format("Ha cancellato l'user {0}", model.Data.UserName)
                    });
                }
            }

            return(Ok(result));
        }