public ActionResult Registration(RegistrationExt model) { //Redirect the User to Error/RestrictedEmailDomain if user enter any Restricted Email Domain while Registration string _Msg = ""; bool _status = true; if (ModelState.IsValid) { if (SecurityUtils.IsRestrictedEmailDomainDetected(model.EmailAddress)) { SecurityUtils.AddAuditLog("Restricted Email Address Detected", "Restricted Email Address: " + model.EmailAddress); return(Json(new { status = false, Msg = "Restricted Email Address: " + model.EmailAddress }, JsonRequestBehavior.AllowGet)); } PlayersExt player = MAP_Registration(model); PlayersRepository playerRepo = new PlayersRepository(); playerRepo.CreateOrUpdate(ref player, ref _Msg, ref _status, this); return(Json(new { status = _status, Msg = _Msg }, JsonRequestBehavior.AllowGet)); } foreach (ModelState modelState in ViewData.ModelState.Values) { foreach (ModelError error in modelState.Errors) { _Msg = _Msg + " " + error.ErrorMessage; } } return(Json(new { status = false, Msg = _Msg }, JsonRequestBehavior.AllowGet)); }
public ActionResult NewIndex(RegistrationExt model) { //if (SecurityUtils.IsRestrictedEmailDomainDetected(model.EmailAddress)) //{ // SecurityUtils.AddAuditLog("Restricted Email Address Detected", "Restricted Email Address: " + model.EmailAddress); // return RedirectToAction("RestrictedEmailDomain", "Error"); //} PlayersExt pModel = MAP_Registration(model); string Msg = ""; bool status = true; ModelState.Remove("id"); pModel.Notes = ""; PlayersRepository modelRepo = new PlayersRepository(); pModel.PlayerID = modelRepo.CreateOrUpdate(ref pModel, ref Msg, ref status, this, false, 0); if (pModel.PlayerID > 0) { ViewBag.RegSuccess = true; } else { ViewBag.RegSuccess = false; } return(View()); }
public PlayersExt MAP_Registration(RegistrationExt RegExt) { PlayersExt model = new PlayersExt() { FirstName = RegExt.FirstName, LastName = RegExt.LastName, EmailAddress = RegExt.EmailAddress, }; return(model); }