public HttpResponseMessage ModifyOrder([FromBody] OrderInfoFromAndroidModel orderFromAndroid) { List <OrderDetail> details = new List <OrderDetail>(); var orderId = orderFromAndroid.OrderId; var itemCount = 0; var totalPrice = Decimal.Zero; foreach (var item in orderFromAndroid.Dishes) { var orderDetail = new OrderDetail(); decimal unitPrice = Convert.ToDecimal(item.UnitPrice); orderDetail.DishId = item.DishId; orderDetail.Count = item.Qty; orderDetail.DishEName = item.EName; orderDetail.DishOName = item.OName; orderDetail.OrderId = orderId; orderDetail.UnitPrice = unitPrice; itemCount += item.Qty; totalPrice += (item.Qty * unitPrice); details.Add(orderDetail); } OrderInfo orderInfo = new OrderInfo(); orderInfo.CreateTime = DateTime.Now; orderInfo.ItemsCount = itemCount; orderInfo.MealNumber = orderFromAndroid.TableHeadcount; orderInfo.MealTime = DateTime.Now; orderInfo.OrderId = orderId; orderInfo.Status = OrderStatusEnum.Dining; orderInfo.TableNum = Convert.ToInt32(orderFromAndroid.TableNum); orderInfo.TotalPrice = totalPrice; orderInfo.WaiterId = orderFromAndroid.WaiterId; OrderBuss buss = new OrderBuss(); buss.UpdateOrderInfoFromTablet(orderInfo, details); return(ToJson(new { Result = true })); }