Infrastructure.OrderRepository.GetOrderById C# (CSharp) Method

GetOrderById() public method

public GetOrderById ( int OrderId ) : Core.Order
OrderId int
return Core.Order
        public Order GetOrderById(int OrderId)
        {
            _customerRepository = new CustomerRepository();
            var order = _context.Orders.Single(o => o.OrderId == OrderId);
            if (order.CustomerId.Length > 0)
                order.Customer = _customerRepository.GetCustomerByCustomerId(order.CustomerId);
            return order;
        }
        public int CreateOrder(Order Order)

Usage Example

Example #1
0
 public void UpdateShipAddress(int OrderId, string Address, string City, string Region, string PostalCode, string Country)
 {
     // Add your operation implementation here
     var repo = new OrderRepository();
     var order = repo.GetOrderById(OrderId);
     order.ShipAddress = Address;
     order.ShipCity = City;
     order.ShipRegion = Region;
     order.ShipPostalCode = PostalCode;
     order.ShipCountry = Country;
     repo.UpdateOrder(order);
     return;
 }