public ActionResult Login(LoginViewModel viewmodel, string returnUrl) { try { if (_accountModel.Login(viewmodel)) { _notyMessage = new NotyMessage { ResponseMessage = "Logged In successfull.", ResponseType = NotyType.success }; TempData["NotyMessage"] = _notyMessage; FormsAuthentication.SetAuthCookie(viewmodel.UserName, viewmodel.RememberMe); return RedirectToLocal(returnUrl); } else { _notyMessage = new NotyMessage { ResponseMessage = "User is not found.", ResponseType = NotyType.error }; TempData["NotyMessage"] = _notyMessage; return View(viewmodel); } } catch (MembershipException ex) { _notyMessage = new NotyMessage { ResponseMessage = ex.Message, ResponseType = NotyType.error }; } catch (Exception ex) { _notyMessage = new NotyMessage { ResponseMessage = SystemMessage.GeneralErrorMessage, ResponseType = NotyType.error }; } TempData["NotyMessage"] = _notyMessage; return View(viewmodel); }
public ActionResult ShowCriminalRecords(CriminalSearchViewModel viewmodel) { try { viewmodel.Criminals = _homeModel.PopulateSearchList(viewmodel).ToList(); return View(viewmodel); } catch (CriminalSearchException ex) { _notyMessage = new NotyMessage { ResponseMessage = ex.Message, ResponseType = NotyType.error }; } catch (Exception ex) { _notyMessage = new NotyMessage { ResponseMessage = SystemMessage.GeneralErrorMessage, ResponseType = NotyType.error }; } TempData["NotyMessage"] = _notyMessage; return RedirectToAction("Index", "Home"); }
public ActionResult Register(RegisterViewModel viewmodel) { try { _accountModel.CreteUser(viewmodel); _notyMessage = new NotyMessage { ResponseMessage = "User has been registered.", ResponseType = NotyType.success }; } catch (MembershipException ex) { _notyMessage = new NotyMessage { ResponseMessage = ex.Message, ResponseType = NotyType.error }; } catch (Exception ex) { _notyMessage = new NotyMessage { ResponseMessage = SystemMessage.GeneralErrorMessage, ResponseType = NotyType.error }; } TempData["NotyMessage"] = _notyMessage; return View(viewmodel); }