public Artist Save(Artist artist) { if (EntityValidatorUtil.Validate <Artist>(artist)) { return(artistDao.Save(artist)); } else { WebOperationContext.Current.OutgoingResponse.StatusCode = HttpStatusCode.NotAcceptable; return(null); } }
public void Post([FromBody] Artist artist) { //先校验 if (ModelState.IsValid) { artistDao.Save(artist); } }