コード例 #1
0
        public JsonResult AdminRegistration(AdminRegisterModel registerModel)
        {
            var result = "";

            if (ModelState.IsValid)
            {
                var isExist = IsEmailExist(registerModel.Email);
                if (isExist == false)
                {
                    ModelState.AddModelError("EmailExist", "Email already exist");
                    result = "Admin Already Registered ! Please choose another user name";


                    return(Json(new { result = result }, JsonRequestBehavior.AllowGet));
                }
                else if (isExist == true)
                {
                    int UserId = repositories.AdminReg(registerModel);
                    if (UserId > 0)
                    {
                        ModelState.Clear();
                        //ViewBag.Issuccess = "Registration Successful";
                        result = "Registration Successful";
                    }
                }
            }

            return(Json(new { result = result }, JsonRequestBehavior.AllowGet));
        }