コード例 #1
0
        public async Task <IActionResult> Create([Bind("Id,Name,Details")] Accion accion)
        {
            if (ModelState.IsValid)
            {
                _context.Add(accion);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(accion));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("Nombre")] Persona persona)
        {
            if (ModelState.IsValid)
            {
                _context.Add(persona);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(persona));
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("Id,Matricula")] Medico medico)
        {
            if (ModelState.IsValid)
            {
                _context.Add(medico);
                await _context.SaveChangesAsync();

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