{"size": 1357, "ext": "js", "max_stars_repo_path": "MomWorld/Content/js/profileCtrl.js", "max_stars_repo_name": "shortgiraffe4/MomWorld", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "MomWorld/Content/js/profileCtrl.js", "max_issues_repo_name": "shortgiraffe4/MomWorld", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "MomWorld/Content/js/profileCtrl.js", "max_forks_repo_name": "shortgiraffe4/MomWorld", "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": 25.1296296296, "max_line_length": 104, "alphanum_fraction": 0.5062638172}
﻿'use strict';

var profileApp = angular.module('profileApp', ['angular-md5']);

profileApp.controller('profileCtrl', ['$scope', '$http', 'md5', function ($scope, $http, md5) {
    
    /* Get Prfile request URL */
    var gravatar = 'http://www.gravatar.com/' + md5.createHash("trungnm0512@gmail.com" || '') + '.json';

    $scope.user = {
    }

    $scope.loadProfile = function () {
        /* Get user Profile from User API */
        $http.get("http://localhost:4444/api/User/user1").
              success(function (data, status, headers, config) {
                  $scope.user = data;
              }).
              error(function (data, status, headers, config) {
                  
              });
    }


    /* Update Profile  */
    $scope.updateProfile = function () {
        

        var sentData = {
            FirstName: $scope.user.FirstName,
            LastName: $scope.user.LastName
        }

        console.log(JSON.stringify(sentData));

        $http.put("http://localhost:4444/api/User/user1", sentData).
              success(function (data, status, headers, config) {
                  alert("Update Ok");
                  console.log(JSON.stringify(data));
              }).
              error(function (data, status, headers, config) {
                  alert("Update CL");
              });

    }






  
}]);
    