Пример #1
0
        public async Task <IActionResult> Create([Bind("EmpresaID,Nome")] Empresa empresa)
        {
            if (ModelState.IsValid)
            {
                _context.Add(empresa);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(empresa));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("Id,Title,ReleaseDate,Genre,Price,Rating")] Movie movie)
        {
            if (ModelState.IsValid)
            {
                _context.Add(movie);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(movie));
        }
Пример #3
0
        public async Task <IActionResult> Create([Bind("FunçãoID,Cargo,EmpresaID")] Função função)
        {
            if (ModelState.IsValid)
            {
                _context.Add(função);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmpresaID"] = new SelectList(_context.Set <Empresa>(), "EmpresaID", "EmpresaID", função.EmpresaID);
            return(View(função));
        }