Advertisement
Guest User

Untitled

a guest
Feb 1st, 2017
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. <body ng-app="LoginModule">
  2. <div id="body" ng-controller="LoginController">
  3. <div>``
  4. <div>
  5. <label id="labels">User Name:</label> <input type="text" ng-model="User.UserName" />
  6. <br />
  7. <label id="labels">Password:&nbsp;</label> <input type="password" ng-model="User.UserPassword" />
  8. <br />
  9. <input id="buttons" class="btn btn-primary" value="Login" type="button" ng-click="Login()" />
  10. </div>
  11. </div>
  12. </div>
  13.  
  14. var loginModuel = angular.module("LoginModule", [])
  15. loginModuel.controller("LoginController", function ($scope, $http) {
  16. alert("LoginController");
  17. $scope.Login = function()
  18. {
  19. alert("Login Function");
  20. var result = $http({ method: 'POST', url: '/Home/Login', params: { user: $scope.User } });
  21. result.success((function() {
  22. window.location.href = '/Doctor/DoctorPanel';
  23. }));
  24. alert($scope.User.UserName + "-" + $scope.User.UserPassword);
  25. }
  26.  
  27. [HttpPost]
  28. public ActionResult Login()
  29. {
  30. JObject json = JObject.Parse(Request["user"]);
  31. string userName = (string)json["UserName"];
  32. string userPass = (string)json["UserPassword"];
  33. User u = New User();
  34. u.User_Name = "Test";
  35. u.User_Password ="ABCD";
  36. if (u.Users_Name == userName && u.Users_Password == userPass)
  37. {
  38. return View("WelcomUser","Home");
  39. }
  40. return View("Index","Home");
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement