コード例 #1
0
        public async Task <IActionResult> Create([Bind("Id,Question_statement,Time,CorrectAnswer,Options,Question_type")] Question question)
        {
            if (ModelState.IsValid)
            {
                _context.Add(question);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(question));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("Id,Title,ReleaseDate,Genre,Price")] 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("Id,Name")] Departamento departamento)
        {
            if (ModelState.IsValid)
            {
                _context.Add(departamento);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(departamento));
        }
コード例 #4
0
 public void Inserir(Vendedor vendedor)
 {
     _contexto.Add(vendedor);
     _contexto.SaveChanges();
 }