//Update the details of a not-executed order public bool UpdateOrder(string orderId, UpdateOrderOption orderForUpdate) { if (OrdersList.Find(o => o.OrderId.Equals(orderId)) == null) { return(false); } var order = OrdersList.Find(o => o.OrderId.Equals(orderId)); var id = OrdersList.Find(o => o.OrderId.Equals(orderId)).CustomerId; if (OrdersList.Find(o => o.OrderId.Equals(orderId)).OrderStatus != 0) { return(false); } if (orderForUpdate.TobeCancel == true) { OrdersList.Remove(OrdersList.Find(o => o.OrderId.Equals(orderId))); if (CustomerService.CustomerList.Find(p => p.CustomerId == id).Orders != null) { CustomerService.CustomerList.Find(p => p.CustomerId == id).Orders.Remove(order); return(true); } } if (!string.IsNullOrWhiteSpace(orderForUpdate.DeliveryAddress)) { OrdersList.Find(o => o.OrderId.Equals(orderId)).DeliveryAddress = orderForUpdate.DeliveryAddress; } return(true); }
public bool UpdateOrder(string orderId, UpdateOrderOption orderForUpdate) { if (OrdersList.Find(o => o.OrderId.Equals(orderId)) == null) { return(false); } if (orderForUpdate.TobeCancel == true) { //edw prepei na to bgaze kai apo ton customer OrdersList.Remove(OrdersList.Find(o => o.OrderId.Equals(orderId))); //CustomerService.CustomerList.Remove(CustomerService.CustomerList.Find(id=>id.CustomerId.Equals(cu))) return(true); } //if (!orderForUpdate.OrderStatus.Equals("not-executable")) { // return false; //} return(true); }