public ActionResult Registration([Bind(Exclude = "IsEmailVerified, ActivationCode")] StudentModel student) { bool status = false; string message = " "; #region // Model Validation if (ModelState.IsValid) { #region //Email is already exist var isexist = IsEmailExist(student.EmailId); if (isexist) { ModelState.AddModelError("EmailExist", "That Email Aleady Exist!"); return(View(student)); } #endregion #region //Activation Code student.ActivationCode = Guid.NewGuid(); #endregion #region //Password Hashing student.Password = PasswordHashing.PasswordConvert(student.Password); student.ConfirmPassword = PasswordHashing.PasswordConvert(student.ConfirmPassword); #endregion int id = repository.AddUser(student); if (id > 0) { ModelState.Clear(); message = "Registration Successfully Done!"; status = true; } } else { message = "Invalid Request"; } #endregion ViewBag.Message = message; ViewBag.Status = status; return(View(student)); }