<commit_before>﻿var app = angular.module('MoTMe', []).run([
   "$rootScope", "$http",
  function ($rootScope, $http) {
      //$http.get("/Manage/GetUserObjectJSON")
      //      .success(function (data) {
      //          console.log(data);
      //          $rootScope.user = data;
      //          console.log($rootScope);
      //          console.log($rootScope.user);
      //      })
      //      .error(function (error) { alert(error.error) });
  }
]);

app.controller('RootCtrl', ["$scope", "$http", "$rootScope", function ($scope, $http, $rootScope) {
    $http.get("/Manage/GetUserObjectJSON")
            .success(function (data) {
                console.log(data);
                $scope.user = data;
                console.log($scope.user);
            })
            .error(function (error) { alert(error.error) });
}])

app.controller('IndexCtrl', ["$scope", "$http", "$rootScope", function ($scope, $http, $rootScope) {
    console.log($scope.user);
    $scope.RefreshMessages = function () {
        console.log($scope.user);
        $http({
            url: "/Manage/GetMessagesByUserId/",
            method: "GET",
            params: {
                uid: $scope.user.Id
            }
        })
            .success(function (data) {
                console.log(data);
                $scope.messages = data;
            })
            .error(function (error) { alert(error.error) });
    };
    //$scope.RefreshMessages();

    $scope.AddMessage = function (message) {
        console.log($scope.user);
        console.log(message);
        if (message != "" && message != null && message != undefined) {
            $http({
                url: "/Manage/AddMessage",
                method: "POST",
                data: {
                    body: message,
                    authorId: $scope.user.Id,
                    recieverId: 1
                }
            }).success(function () {
                $scope.RefreshMessages();
            });
        }
        $scope.RefreshMessages();
    };
}])

app.controller('AboutCtrl', ["$scope", "$http", "$rootScope", function ($scope, $http, $rootScope) {
    $scope.test = "click me";
    console.log($scope.test);


    $scope.hello = function () {
        console.log($scope.user);

        //$http.get("/Home/Get")
        //    .success(function (data) {
        //        $scope.test = data;
        //    })
        //    .error(function (error) { alert(error.error) });

        $http.get("/Manage/GetUserIdLink")
            .success(function (data) {
                $scope.UserIdLink = data;
            })
            .error(function (error) { alert(error.error) });

        $http.get("/Manage/GetUserId")
            .success(function (data) {
                $scope.UserId = data;
            })
            .error(function (error) { alert(error.error) });

        //$http.get("/User/GetUserId_Int")
        //    .success(function (data) {
        //        $scope.UserId = data;
        //    })
        //    .error(function (error) { alert(error.error) });
    }
}]);<commit_msg>using  to run code after user is created<commit_after>﻿var app = angular.module('MoTMe', []).run([
   "$rootScope", "$http",
  function ($rootScope, $http) {
      //$http.get("/Manage/GetUserObjectJSON")
      //      .success(function (data) {
      //          console.log(data);
      //          $rootScope.user = data;
      //          console.log($rootScope);
      //          console.log($rootScope.user);
      //      })
      //      .error(function (error) { alert(error.error) });
  }
]);

app.controller('RootCtrl', ["$scope", "$http", "$rootScope", function ($scope, $http, $rootScope) {
    $http.get("/Manage/GetUserObjectJSON")
            .success(function (data) {
                console.log(data);
                $scope.user = data;
                console.log($scope.user);
            })
            .error(function (error) { alert(error.error) });
}])

app.controller('IndexCtrl', ["$scope", "$http", "$rootScope", function ($scope, $http, $rootScope) {
    console.log($scope.user);
    $scope.RefreshMessages = function () {
        console.log($scope.user);
        $http({
            url: "/Manage/GetMessagesByUserId/",
            method: "GET",
            params: {
                uid: $scope.user.Id
            }
        })
            .success(function (data) {
                console.log(data);
                $scope.messages = data;
            })
            .error(function (error) { alert(error.error) });
    };
    $scope.$watch('user', function (oldValue, newValue) {
        $scope.RefreshMessages();
    });
    //$scope.RefreshMessages();

    $scope.AddMessage = function (message) {
        console.log($scope.user);
        console.log(message);
        if (message != "" && message != null && message != undefined) {
            $http({
                url: "/Manage/AddMessage",
                method: "POST",
                data: {
                    body: message,
                    authorId: $scope.user.Id,
                    recieverId: 1
                }
            }).success(function () {
                $scope.RefreshMessages();
            });
        }
        $scope.RefreshMessages();
    };
}])

app.controller('AboutCtrl', ["$scope", "$http", "$rootScope", function ($scope, $http, $rootScope) {
    $scope.test = "click me";
    console.log($scope.test);


    $scope.hello = function () {
        console.log($scope.user);

        //$http.get("/Home/Get")
        //    .success(function (data) {
        //        $scope.test = data;
        //    })
        //    .error(function (error) { alert(error.error) });

        $http.get("/Manage/GetUserIdLink")
            .success(function (data) {
                $scope.UserIdLink = data;
            })
            .error(function (error) { alert(error.error) });

        $http.get("/Manage/GetUserId")
            .success(function (data) {
                $scope.UserId = data;
            })
            .error(function (error) { alert(error.error) });

        //$http.get("/User/GetUserId_Int")
        //    .success(function (data) {
        //        $scope.UserId = data;
        //    })
        //    .error(function (error) { alert(error.error) });
    }
}]);
{'fraction_non_alphanumeric': 0.17527411409502622, 'fraction_numerical': 0.0003178134435086604, 'mean_word_length': 1.5689795918367346, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '726486', 'n_tokens_mistral': 1826, 'n_tokens_neox': 1793, 'n_words': 292}