예제 #1
0
        public async Task <IActionResult> Create([Bind("SoldierId,FirstName,LastName,Paygrade,WeaponId,DoDid,ArrivalDate")] Soldier soldier)
        {
            if (ModelState.IsValid)
            {
                _context.Add(soldier);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Paygrade"] = new SelectList(_context.Paygrade, "Paygrade1", "Paygrade1", soldier.Paygrade);
            ViewData["WeaponId"] = new SelectList(_context.Weapon, "WeaponId", "WeaponId", soldier.WeaponId);
            return(View(soldier));
        }
        public async Task <IActionResult> Create([Bind("WorkOrderId,WeaponId,FaultDesc,WeaponStatus,WorkOrderStatus,StartDate,EndDate")] WorkOrder workOrder)
        {
            if (ModelState.IsValid)
            {
                _context.Add(workOrder);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["WeaponId"]        = new SelectList(_context.Weapon, "WeaponId", "WeaponId", workOrder.WeaponId);
            ViewData["WeaponStatus"]    = new SelectList(_context.WeaponStatus, "WeaponStatus1", "WeaponStatus1", workOrder.WeaponStatus);
            ViewData["WorkOrderStatus"] = new SelectList(_context.WorkOrderStatus, "WorkOrderStatus1", "WorkOrderStatus1", workOrder.WorkOrderStatus);
            return(View(workOrder));
        }
예제 #3
0
        public async Task <IActionResult> Create([Bind("WeaponId,Serial,Nomenclature,EquipmentType,Platoon,ArrivalDate")] Weapon weapon)
        {
            if (ModelState.IsValid)
            {
                _context.Add(weapon);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EquipmentType"] = new SelectList(_context.EquipmentType, "EquipmentType1", "EquipmentType1", weapon.EquipmentType);
            ViewData["Nomenclature"]  = new SelectList(_context.Nomenclature, "Nomenclature1", "Nomenclature1", weapon.Nomenclature);
            ViewData["Platoon"]       = new SelectList(_context.Platoon, "Platoon1", "Platoon1", weapon.Platoon);
            return(View(weapon));
        }