public async Task <ActionResult> AddParrain(ParrainViewModel model) { if (ModelState.IsValid) { var user = await dal.GetUsersList().FirstOrDefaultAsync(m => m.Email == model.Email); if (user != null) { var parrain = new ParrainModel() { Date_createParrain = DateTime.Now, ParrainEmail = user.Email, ParrainFirstName = user.FirstName }; dal.AddParrain(parrain); return(RedirectToAction("ListAllAgents")); } else { return(RedirectToAction("ListAllAgents")); } } return(RedirectToAction("ListAllAgents")); }