public IActionResult Register([Bind] User user) { try { if (ModelState.IsValid) { var result = _userDB.createUser(user); if (result.error) { TempData["msg"] = result.message; return(View("~/Views/Register/Index.cshtml")); } else { TempData["msg"] = result.message; return(RedirectToAction("Index", "Login")); } } } catch (Exception e) { TempData["msg"] = e.Message; } return(View("~/Views/Register/Index.cshtml")); }