public ActionResult Edit(long id) { ReceivingPost receiving = _receivingService.GetPost(id); if (receiving == null) { return(NotFound()); } ViewBag.ixHandlingUnit = new SelectList(_receivingService.selectHandlingUnits().Select(x => new { x.ixHandlingUnit, x.sHandlingUnit }), "ixHandlingUnit", "sHandlingUnit", receiving.ixHandlingUnit); ViewBag.ixHandlingUnitType = new SelectList(_receivingService.selectHandlingUnitTypesNullable().Select(x => new { ixHandlingUnitType = x.Key, sHandlingUnitType = x.Value }), "ixHandlingUnitType", "sHandlingUnitType", receiving.ixHandlingUnitType); //Custom Code Start | Replaced Code Block //Replaced Code Block Start //ViewBag.ixInboundOrder = new SelectList(_receivingService.selectInboundOrders().Select(x => new { x.ixInboundOrder, x.sInboundOrder }), "ixInboundOrder", "sInboundOrder"); //Replaced Code Block End ViewBag.ixInboundOrder = new SelectList(_receivingService.selectInboundOrdersFirst().Select(x => new { ixInboundOrder = x.Key, sInboundOrder = x.Value }), "ixInboundOrder", "sInboundOrder"); //Custom Code End ViewBag.ixInventoryLocation = new SelectList(_receivingService.selectInventoryLocations().Select(x => new { x.ixInventoryLocation, x.sInventoryLocation }), "ixInventoryLocation", "sInventoryLocation", receiving.ixInventoryLocation); ViewBag.ixInventoryState = new SelectList(_receivingService.selectInventoryStates().Select(x => new { x.ixInventoryState, x.sInventoryState }), "ixInventoryState", "sInventoryState", receiving.ixInventoryState); ViewBag.ixMaterial = new SelectList(_receivingService.selectMaterials().Select(x => new { x.ixMaterial, x.sMaterial }), "ixMaterial", "sMaterial", receiving.ixMaterial); ViewBag.ixMaterialHandlingUnitConfiguration = new SelectList(_receivingService.selectMaterialHandlingUnitConfigurationsNullable().Select(x => new { ixMaterialHandlingUnitConfiguration = x.Key, sMaterialHandlingUnitConfiguration = x.Value }), "ixMaterialHandlingUnitConfiguration", "sMaterialHandlingUnitConfiguration", receiving.ixMaterialHandlingUnitConfiguration); ViewBag.ixStatus = new SelectList(_receivingService.selectStatuses().Select(x => new { x.ixStatus, x.sStatus }), "ixStatus", "sStatus", receiving.ixStatus); return(View(receiving)); }