Exemple #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Personid,Firstname,Lastname")] Person person)
        {
            if (id != person.Personid)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(person);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PersonExists(person.Personid))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(person));
        }
Exemple #2
0
        public async Task <IActionResult> Edit(int id, [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 (id != ship.Shipid)
            {
                return(NotFound());
            }

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