public ActionResult SearchInventory(string inventoryId, string groupId) { var inventoryItem = InventoryDataService.GetInventoryRecordById(inventoryId, groupId); var inventoryItems = InventoryDataService.GetInventoryRecordsByGroupId(groupId); ViewBag.iD = groupId; if (inventoryItem.Count == 0) { return(View("Inventory", new InventoryViewModel() { Records = inventoryItems, SelectedRecord = inventoryItems.First() })); } return(View("Inventory", new InventoryViewModel() { Records = inventoryItems, SelectedRecord = inventoryItem.First() })); }