public Order ReceiveOrder(Cart cart, string username) { var order = new Order{ Username = username, OrderDate = DateTime.Now, Status = "Received", Total = cart.ComputeTotal(), //CompleteDate = new DateTime(1900,1,1) }; db.Orders.Add(order); AddOrderDetails(order, cart); db.SaveChanges(); cart.Clear(); return order; }