public object CheckDupicate(int authorityId, string name) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } string orgCode = User.Claims.Where(u => u.Type == AuthorityConstant.orgCode).FirstOrDefault().Value; if (!string.IsNullOrEmpty(name)) { if (_authorityRepository.CheckDuplicate(authorityId, name, orgCode)) { var obj = new { existed = false, message = AuthorityConstant.CheckDupicateOK }; return(StatusCode(200, obj)); } else { var obj = new { existed = true, message = AuthorityConstant.MessageAddError }; return(StatusCode(200, obj)); } } else { var obj = new { existed = false, message = AuthorityConstant.CheckDupicateOK }; return(StatusCode(200, obj)); } }