Exemplo n.º 1
0
        public async Task <IActionResult> Edit(byte id, [Bind("Idregime,Idhotel,TipoRegime")] Regimes regimes)
        {
            if (id != regimes.Idregime)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(regimes);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RegimesExists(regimes.Idregime))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Idhotel"] = new SelectList(_context.Hoteis, "Idhotel", "CodPostal", regimes.Idhotel);
            return(View(regimes));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("Idregime,Idhotel,TipoRegime")] Regimes regimes)
        {
            if (ModelState.IsValid)
            {
                _context.Add(regimes);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Idhotel"] = new SelectList(_context.Hoteis, "Idhotel", "CodPostal", regimes.Idhotel);
            return(View(regimes));
        }
 public CreateUpdateDeleteScreen(Regimes ChoosingRegime, Tables ChoosingTable)
 {
     InitializeComponent();
     this.ChoosingRegime = ChoosingRegime;
     this.ChoosingTable  = ChoosingTable;
 }