Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Canal,User,Notificar")] InscritosCanal inscritosCanal)
        {
            if (id != inscritosCanal.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(inscritosCanal);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!InscritosCanalExists(inscritosCanal.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Canal"] = new SelectList(_context.Canal, "Id", "Id", inscritosCanal.Canal);
            ViewData["User"]  = new SelectList(_context.User, "Id", "Id", inscritosCanal.User);
            return(View(inscritosCanal));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("Id,Canal,User,Notificar")] InscritosCanal inscritosCanal)
        {
            if (ModelState.IsValid)
            {
                _context.Add(inscritosCanal);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Canal"] = new SelectList(_context.Canal, "Id", "Id", inscritosCanal.Canal);
            ViewData["User"]  = new SelectList(_context.User, "Id", "Id", inscritosCanal.User);
            return(View(inscritosCanal));
        }