Example #1
0
        public async Task <IActionResult> Edit(int id, [Bind("IdRegRemo,Date,NroRemoções,MotivoIdMotivo,CausaMorte,TanqueIdTanque")] RegRemocoes regRemocoes)
        {
            if (id != regRemocoes.IdRegRemo)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(regRemocoes);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RegRemocoesExists(regRemocoes.IdRegRemo))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MotivoIdMotivo"] = new SelectList(_context.Motivo, "IdMotivo", "NomeMotivo", regRemocoes.MotivoIdMotivo);
            ViewData["TanqueIdTanque"] = new SelectList(_context.Tanque, "IdTanque", "Sala", regRemocoes.TanqueIdTanque);
            return(View(regRemocoes));
        }
Example #2
0
        public async Task <IActionResult> Create([Bind("IdRegRemo,Date,NroRemoções,MotivoIdMotivo,CausaMorte,TanqueIdTanque")] RegRemocoes regRemocoes)
        {
            if (ModelState.IsValid)
            {
                _context.Add(regRemocoes);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MotivoIdMotivo"] = new SelectList(_context.Motivo, "IdMotivo", "NomeMotivo", regRemocoes.MotivoIdMotivo);
            ViewData["TanqueIdTanque"] = new SelectList(_context.Tanque.Where(p => p.isarchived == 0), "IdTanque", "codidenttanque");
            return(View(regRemocoes));
        }