Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("empleadoId,tiendaId,fecha")] tiendaEmpleado tiendaEmpleado)
        {
            if (id != tiendaEmpleado.empleadoId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tiendaEmpleado);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!tiendaEmpleadoExists(tiendaEmpleado.empleadoId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["empleadoId"] = new SelectList(_context.empleado, "empleadoId", "empleadoId", tiendaEmpleado.empleadoId);
            ViewData["tiendaId"]   = new SelectList(_context.tienda, "tiendaId", "tiendaId", tiendaEmpleado.tiendaId);
            return(View(tiendaEmpleado));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("empleadoId,tiendaId,fecha")] tiendaEmpleado tiendaEmpleado)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tiendaEmpleado);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["empleadoId"] = new SelectList(_context.empleado, "empleadoId", "empleadoId", tiendaEmpleado.empleadoId);
            ViewData["tiendaId"]   = new SelectList(_context.tienda, "tiendaId", "tiendaId", tiendaEmpleado.tiendaId);
            return(View(tiendaEmpleado));
        }