public ActionResult Create() { if (!IsConnected) { return(RedirectToAction("Index", "Home")); } return(View(new AddCustomerForm { Bankers = bankerRepo.GetBankers().Select(b => new SelectListItem { Value = b.ID.ToString(), Text = b.FirstName + " " + b.LastName }) })); }
public ActionResult LoginBanker(LoginBankerForm form) { if (ModelState.IsValid) { try { var banker = bankerRepo.GetBankers() .First(c => c.Mail == form.Email); if (banker.Password != form.Password) { ModelState.AddModelError("password", "mot de passe incorrect"); } if (ModelState.IsValid) { Session.Clear(); Session[Utils.SessionBanker] = banker; return(RedirectToAction("Index", "Banker")); } } catch (Exception) { ModelState.AddModelError("CustomerNumber", "numéro client inconnu"); } } return(View()); }