public async Task <IActionResult> Edit(int id, [Bind("WeaponId,Name,Description,Price,Weight,Type,Range,ClipSize,FireRate")] Weapon weapons)
        {
            if (id != weapons.WeaponId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(weapons);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!WeaponsExists(weapons.WeaponId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(weapons));
        }
예제 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("ArmorId,Name,Description,Price,Weight,Type,Dexterity,KineticBarrier,MediGelCapacity")] Armor armor)
        {
            if (id != armor.ArmorId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(armor);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ArmorExists(armor.ArmorId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(armor));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ShipId,Name,Description,Price,Ftl,Type,ArmorType,KineticBarrier")] Ship ships)
        {
            if (id != ships.ShipId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(ships);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ShipsExists(ships.ShipId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(ships));
        }