예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("SoldierId,FirstName,LastName,Paygrade,WeaponId,DoDid,ArrivalDate")] Soldier soldier)
        {
            if (id != soldier.SoldierId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(soldier);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SoldierExists(soldier.SoldierId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                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> Edit(int id, [Bind("WorkOrderId,WeaponId,FaultDesc,WeaponStatus,WorkOrderStatus,StartDate,EndDate")] WorkOrder workOrder)
        {
            if (id != workOrder.WorkOrderId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(workOrder);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!WorkOrderExists(workOrder.WorkOrderId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                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> Edit(int id, [Bind("WeaponId,Serial,Nomenclature,EquipmentType,Platoon,ArrivalDate")] Weapon weapon)
        {
            if (id != weapon.WeaponId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(weapon);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!WeaponExists(weapon.WeaponId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                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));
        }