public void GetUserPerformTest() { var userTest = new UserServiceTest(); userTest.SetUp(); userTest.GetUser(); _counter.Increment(); }
public ActionResult Login(UserModel userModel) { if (!ModelState.IsValid) { return(this.View()); } //MD5 md5Hash = MD5.Create(); //string encryptedPassword = Encryptor.GetMd5Hash(md5Hash, userModel.Password); int RoleID = UserServiceTest.Login(userModel.EmailAddress, userModel.Password); if (RoleID == 0) { //Console.WriteLine("Login failed"); ModelState.AddModelError("LoginFailedError", "Invalid login attempt."); return(View(userModel)); } else if (RoleID == 1) { userModel.Role = "Admin"; PerformFormAuthentication(userModel); return(RedirectToAction("StudentInfo", "Home")); } else if (RoleID == 2) { userModel.Role = "Staff"; PerformFormAuthentication(userModel); return(RedirectToAction("StudentInfo", "Home")); } else if (RoleID == 3) { userModel.Role = "Student"; PerformFormAuthentication(userModel); return(RedirectToAction("DisplayStudent", "Home", new { email = userModel.EmailAddress })); } return(View()); }