コード例 #1
0
        public ActionResult Create([Bind("ixReceipt,sReceipt,ixInventoryLocation,ixInboundOrder,ixHandlingUnit,ixMaterial,ixMaterialHandlingUnitConfiguration,ixHandlingUnitType,nHandlingUnitQuantity,sSerialNumber,sBatchNumber,dtExpireAt,nBaseUnitQuantityReceived,ixInventoryState,ixStatus")] ReceivingPost receiving)
        {
            //var modelState = ModelState.Where(x => x.Value.Errors.Count > 0).Select(x => x.Key).ToList();
            if (ModelState.IsValid)
            {
                receiving.UserName = User.Identity.Name;
                _receivingService.Create(receiving);

                //Custom Code Start | Replaced Code Block
                //Replaced Code Block Start
                //return RedirectToAction("Index");
                //Replaced Code Block End
                return(RedirectToAction("Create"));
                //Custom Code End
            }
            ViewBag.ixHandlingUnit     = new SelectList(_receivingService.selectHandlingUnits().Select(x => new { x.ixHandlingUnit, x.sHandlingUnit }), "ixHandlingUnit", "sHandlingUnit");
            ViewBag.ixHandlingUnitType = new SelectList(_receivingService.selectHandlingUnitTypes().Select(x => new { x.ixHandlingUnitType, x.sHandlingUnitType }), "ixHandlingUnitType", "sHandlingUnitType");
            //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");
            ViewBag.ixInventoryState    = new SelectList(_receivingService.selectInventoryStates().Select(x => new { x.ixInventoryState, x.sInventoryState }), "ixInventoryState", "sInventoryState");
            ViewBag.ixMaterial          = new SelectList(_receivingService.selectMaterials().Select(x => new { x.ixMaterial, x.sMaterial }), "ixMaterial", "sMaterial");
            ViewBag.ixMaterialHandlingUnitConfiguration = new SelectList(_receivingService.selectMaterialHandlingUnitConfigurations().Select(x => new { x.ixMaterialHandlingUnitConfiguration, x.sMaterialHandlingUnitConfiguration }), "ixMaterialHandlingUnitConfiguration", "sMaterialHandlingUnitConfiguration");
            ViewBag.ixStatus = new SelectList(_receivingService.selectStatuses().Select(x => new { x.ixStatus, x.sStatus }), "ixStatus", "sStatus");

            return(View(receiving));
        }