BExIS.Web.Shell.Areas.SAM.Controllers.UsersController.ValidateEmail C# (CSharp) Method

ValidateEmail() public method

public ValidateEmail ( string email, long id ) : System.Web.Mvc.JsonResult
email string
id long
return System.Web.Mvc.JsonResult
        public JsonResult ValidateEmail(string email, long id = 0)
        {
            SubjectManager subjectManager = new SubjectManager();

            User user = subjectManager.GetUserByEmail(email);

            if (user == null)
            {
                return Json(true, JsonRequestBehavior.AllowGet);
            }
            else
            {
                if (user.Id == id)
                {
                    return Json(true, JsonRequestBehavior.AllowGet);
                }
                else
                {
                    string error = String.Format(CultureInfo.InvariantCulture, "The Email Address exists already.", email);

                    return Json(error, JsonRequestBehavior.AllowGet);
                }
            }
        }