Using ASP MVC and SQL Server, I am trying to test the existence of a client before creating him via the uniqueness of his Email's value.

Following a lot of tutorials and solutions, I didn't success to resolve this problem. This is what I've tried :

**ClientController :**

```
 [HttpPost]
    public ActionResult Create(Client cmodel)
    {
        try
        {
            if (ModelState.IsValid)
            {
                ClientManagement cdb = new ClientManagement();
                if (cdb.AddClient(cmodel))
                {

                    ViewBag.Message = "Client Details Added Successfully";
                    ModelState.Clear();
                }
            }
            return RedirectToAction("Index");
        }
        catch
        {
            return View();
        }
    }

 public JsonResult IsClientExist(string Email)
    {

        List<Client> cm = new List<Client>();

        return Json(!cm.Any(x => x.Email == Email), JsonRequestBehavior.AllowGet);
    }

```

**Class ClientManagement :**

```
 public bool AddClient(Client cmodel)
    {
        connection();
        SqlCommand cmd = new SqlCommand("AddNewClients", con);
        cmd.CommandType = CommandType.StoredProcedure;

        cmd.Parameters.AddWithValue("@Email", cmodel.Email);
        cmd.Parameters.AddWithValue("@Password", cmodel.Password);

        con.Open();
        int i = cmd.ExecuteNonQuery();
        con.Close();

        if (i >= 1)
            return true;
        else
            return false;
    }

```

**Model Client :**

```
 public class Client
{

    [Display(Name = "Email")]
    [Required(ErrorMessage = "Email is required.")]
    [EmailAddress(ErrorMessage = "Invalid Email Address")]
    [DataType(DataType.EmailAddress)]
    [StringLength(30)]
    [Remote("IsClientExist", "Client", ErrorMessage = "Email is already exists in Database.")]
    public string Email { get; set; }

    [Display(Name = "Password")]
    [DataType(DataType.Password)]
    [Required(ErrorMessage = "Password is required.")]
    public string Password { get; set; }
}

```

**View Create :**

```
<div class="form-group">
        @Html.LabelFor(model => model.Email, htmlAttributes: new { @class = "control-label col-md-2" })
        <div class="col-md-10">
            @Html.EditorFor(model => model.Email, new { htmlAttributes = new { @class = "form-control" } })
            @Html.ValidationMessageFor(model => model.Email, "", new { @class = "text-danger" })
        </div>
    </div>
    <script src="~/Scripts/jquery-1.10.2.min.js"></script>
    <script src="~/Scripts/jquery.validate.min.js"></script>
   <script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>

```