{"size": 1413, "ext": "js", "max_stars_repo_path": "IEB3C.Client/app/products/mainCtrl.js", "max_stars_repo_name": "carydiy/BackToFront", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "IEB3C.Client/app/products/mainCtrl.js", "max_issues_repo_name": "carydiy/BackToFront", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "IEB3C.Client/app/products/mainCtrl.js", "max_forks_repo_name": "carydiy/BackToFront", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 27.1730769231, "max_line_length": 81, "alphanum_fraction": 0.4125973107}
(function () {
    "use strict";
    angular
        .module("productManagement")
        .controller("MainCtrl",
                     MainCtrl);


    function MainCtrl(userAccount) {
        var vm = this;
        vm.isLoggedIn = false;
        vm.message = '';
        vm.userData = {
            userName: '',
            email: '',
            password: '',
            confirmPassword: ''
        }
        vm.registerUser = function () {
            vm.userData.confirmPassword = vm.userData.password;
            userAccount.registerUser(vm.userData,
                function (data) {
                    vm.confirmPassword = "";
                    vm.message = "Registration successful";
                    vm.login();
                },
                function (response) {
                    vm.isLoggedIn = false;
                    vm.message = response.statusText + "\r\n";
                    if (response.data.exceptionMessage) {
                        vm.message += response.data.exceptionMessage;
                    }
                    if (response.data.modelState) {
                        for (var key in response.data.modelState) {
                            vm.message += response.data.modelState[key] + "\r\n";
                        }

                    }
                });
            
        }
        vm.login = function () {
        }
        
       

    }


}());

