Esempio n. 1
0
        public async Task <IActionResult> Edit(string id, [Bind("ShipClass,Abbreviation")] ShipClasses shipClasses)
        {
            if (id != shipClasses.Abbreviation)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(shipClasses);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ShipClassesExists(shipClasses.Abbreviation))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(shipClasses));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("ShipClass,Abbreviation")] ShipClasses shipClasses)
        {
            if (ModelState.IsValid)
            {
                _context.Add(shipClasses);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(shipClasses));
        }
 public InfoModule(ShipClasses shipClass, float dcModifier = 0)
     : base(-10, 0, "Info module")
 {
     ShipClass  = shipClass;
     DCModifier = dcModifier;
 }
Esempio n. 4
0
 public Ship(int id, string name, double range, string description, ShipClasses shipClass)
     : base(id, name, description)
 {
     ShipClass = shipClass;
     Range     = range;
 }
Esempio n. 5
0
        public ShipClass GetShipClass(string name)
        {
            ShipClass result;

            return(!string.IsNullOrEmpty(name) && ShipClasses.TryGetValue(name, out result) ? result : null);
        }