public object ConfirmOrder([FromBody] IEnumerable <Order> details) { if (details == null || !details.Any()) { return(Result.GenError <Result>(Error.ParamError)); } if (details.Any(x => x.Id == 0)) { return(Result.GenError <Result>(Error.OrderNotExist)); } var ids = details.Select(x => x.Id); var data = OrderHelper.Instance.GetByIds <Order>(ids); if (data.Count() != details.Count()) { return(Result.GenError <Result>(Error.OrderNotExist)); } if (data.Any(x => x.ConfirmId != 0)) { return(Result.GenError <Result>(Error.OrderConfirmed)); } var markedDateTime = DateTime.Now; foreach (var detail in details) { detail.MarkedDateTime = markedDateTime; detail.ConfirmTime = markedDateTime; } OrderHelper.Confirm(details); return(Result.GenError <Result>(Error.Success)); }