public IActionResult RegisterFilter(UserViewModel userviewmodel) { if (ModelState.IsValid) { userviewmodel.HelperType = "add"; if (userviewmodel.AddEditUser(userviewmodel) == false || userviewmodel.EmailValidator(userviewmodel) == false) { ViewBag.Message = "No Special Characters"; return(View("~/Views/Home/Register.cshtml")); } userviewmodel.AddEditUser(userviewmodel); return(RedirectToAction("Login", "Home")); } ViewBag.Message = "All Boxes must be filled"; return(View("~/Views/Home/Register.cshtml")); }
public void Test_AddEditUser() { var sutAdd = new UserViewModel { HelperType = "add", Username = "******", Password = "******", Firstname = "Bob", Lastname = "Jan", Email = "*****@*****.**" }; var test = sutAdd.AddEditUser(sutAdd); Assert.True(test); }
public IActionResult EditUserInfo(UserViewModel user) { var sessionUserId = HttpContext.Session.GetInt32("UserId"); var editedUser = new UserViewModel { UserId = (int)sessionUserId, Firstname = user.Firstname, Lastname = user.Lastname, Email = user.Email, Username = user.Username, Password = user.Password }; if (editedUser.AddEditUser(editedUser)) { HttpContext.Session.SetString("Username", user.Username); } return(RedirectToAction("Account", "Home")); }