我正在构建一个 Web API 方法来检查名称是否在该类型中是唯一的,并且需要确保给出 name 参数。返回的正确状态码是什么?
public HttpResponseMessage GetIsNameUnique(string name)
{
if (string.IsNullOrWhiteSpace(layoutName))
{
throw new HttpResponseException(new HttpResponseMessage {
StatusCode = HttpStatusCode.{What Goes Here?},
Content = new StringContent("The name is required.")
});
}
// more code here to check....
}