public JsonResult doesBranchNameExist(string BranchName, int Id) { var data = _branchService.CheckBranchNameExists(BranchName, Id); var result = ""; //Check if branch name already exists if (data != null) { if (BranchName.ToLower() == data.ToLower().ToString()) { result = "Branch Name Already Exists"; } else { result = ""; } } return(Json(result)); }