I have model for register

my model class

public class RegisterViewModel
{


    [Required]
    [StringLength(100, ErrorMessage = "Please enter a minimum of {2} characters", MinimumLength = 6)]
    [DisplayName("University ID")]
    [Remote("doesusernameExist", "HEC",null, ErrorMessage = "usr name is allready exist", HttpMethod = "POST")]
    public string usrname { get; set; }    }

my json controller class

 [HttpPost]
    public JsonResult doesusernameExist(string usrname)
    {

         var institute = db.Institutes.Find(HEI_ID);
                   return Json(institute == null);


    }

for create new user and edit user I'm using above model . so without create another model , I want to disable doesusernameExist calling method in edit method

Related posts

Recent Viewed