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)); }
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; }
public Ship(int id, string name, double range, string description, ShipClasses shipClass) : base(id, name, description) { ShipClass = shipClass; Range = range; }
public ShipClass GetShipClass(string name) { ShipClass result; return(!string.IsNullOrEmpty(name) && ShipClasses.TryGetValue(name, out result) ? result : null); }