I have 2 object models here is the first and second.
Inventory
public int Inventory_ID { get; set; }
public string ResType { get; set; }
public string RoomType { get; set; }
public DateTime? Date_Inventory { get; set; }
public string CalledInPort { get; set; }
public string HotelName { get; set; }
public string HotelAddres { get; set; }
Inventory_Info
public int Inventory_ID { get; set; }
public DateTime? Inventory_Date { get; set; }
public int Hotel_ID { get; set; }
public int Total_Rooms_Available { get; set; }
public string HotelName { get; set; }
public string Hotel_Addr1 { get; set; }
public string Hotel_City { get; set; }
public string Hotel_State { get; set; }
public string Hotel_Zip { get; set; }
I loaded each model with data from tables. The inventory model HotelName field is null at this point, but both share inventory_ID is there a enumerable method to query inventory_info model by the inventory ID and find the hotelname set it to the null field in Inventory model?
There var 'output' is inventory model, var 'InventoryInfo' is where the hotel name information is at.
I have tried this so far but not sure where to go , any help would be appreciated. Thank you.
foreach (var item in output)
{
//set name
item.HotelName = InventoryInfo.Where(u => u.Inventory_ID == item.Inventory_ID)//find name?
//set address
//item.HotelAddres=
}