コード例 #1
0
ファイル: PeopleController.cs プロジェクト: axelbkv/OpenSSN
        public async Task <IActionResult> Create([Bind("Personid,Firstname,Lastname")] Person person)
        {
            if (ModelState.IsValid)
            {
                _context.Add(person);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(person));
        }
コード例 #2
0
ファイル: ShipsController.cs プロジェクト: axelbkv/OpenSSN
        public async Task <IActionResult> Create([Bind("Shipid,ShiphulltypeShiphulltypeid,ShippowertypeShippowertypeid,ShipbreadthtypeShipbreadthtypeid,ShiplengthtypeShiplengthtypeid,ShipflagcodeShipflagcodeid,CountryCountryid,ShipsourceShipsourceid,ShipstatusShipstatusid,CompanyCompanyid,ShiptypeShiptypeid,Imono,Yearofbuild,Mmsino,Shipname,Callsign,Dwt,Grosstonnage,Shiplength,Breadth,Speed,Power,Height,Draught,Hassidethrusters,Hassidethrustersfront,Hassidethrustersback,Remark")] Ship ship)
        {
            if (ModelState.IsValid)
            {
                _context.Add(ship);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CompanyCompanyid"] = new SelectList(_context.Company, "Companyid", "Companyid", ship.CompanyCompanyid);
            ViewData["CountryCountryid"] = new SelectList(_context.Country, "Countryid", "Countryid", ship.CountryCountryid);
            ViewData["ShipbreadthtypeShipbreadthtypeid"] = new SelectList(_context.Shipbreadthtype, "Shipbreadthtypeid", "Shipbreadthtype1", ship.ShipbreadthtypeShipbreadthtypeid);
            ViewData["ShipflagcodeShipflagcodeid"]       = new SelectList(_context.Shipflagcode, "Shipflagcodeid", "Shipflagcodeid", ship.ShipflagcodeShipflagcodeid);
            ViewData["ShiphulltypeShiphulltypeid"]       = new SelectList(_context.Shiphulltype, "Shiphulltypeid", "Shiphulltype1", ship.ShiphulltypeShiphulltypeid);
            ViewData["ShiplengthtypeShiplengthtypeid"]   = new SelectList(_context.Shiplengthtype, "Shiplengthtypeid", "Shiplengthtype1", ship.ShiplengthtypeShiplengthtypeid);
            ViewData["ShippowertypeShippowertypeid"]     = new SelectList(_context.Shippowertype, "Shippowertypeid", "Shippowertype1", ship.ShippowertypeShippowertypeid);
            ViewData["ShipsourceShipsourceid"]           = new SelectList(_context.Shipsource, "Shipsourceid", "Shipsource1", ship.ShipsourceShipsourceid);
            ViewData["ShipstatusShipstatusid"]           = new SelectList(_context.Shipstatus, "Shipstatusid", "Shipstatus1", ship.ShipstatusShipstatusid);
            ViewData["ShiptypeShiptypeid"] = new SelectList(_context.Shiptype, "Shiptypeid", "Systemname", ship.ShiptypeShiptypeid);
            return(View(ship));
        }