コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Sucur_empleId,SucursualesId,EmpleadoId")] Sucur_emple sucur_emple)
        {
            if (id != sucur_emple.Sucur_empleId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(sucur_emple);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Sucur_empleExists(sucur_emple.Sucur_empleId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmpleadoId"] = new SelectList(_context.Empleado, "EmpleadoId", "Correo", sucur_emple.EmpleadoId);
            return(View(sucur_emple));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("Sucur_empleId,SucursualesId,EmpleadoId")] Sucur_emple sucur_emple)
        {
            if (ModelState.IsValid)
            {
                _context.Add(sucur_emple);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmpleadoId"] = new SelectList(_context.Empleado, "EmpleadoId", "Correo", sucur_emple.EmpleadoId);
            return(View(sucur_emple));
        }