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