public async Task <IActionResult> Edit(long id, [Bind("trabajadorId,identificacion,tipoindetificacion,primernombre,segundonombre,primerapellido,segundoapellido,fechadenacimineto,Id")] trabajadores trabajadores)
        {
            if (id != trabajadores.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(trabajadores);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!trabajadoresExists(trabajadores.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Id"] = new SelectList(_context.Set <contratos>(), "Id", "Id", trabajadores.Id);
            return(View(trabajadores));
        }
        public async Task <IActionResult> Create([Bind("trabajadorId,identificacion,tipoindetificacion,primernombre,segundonombre,primerapellido,segundoapellido,fechadenacimineto,Id")] trabajadores trabajadores)
        {
            if (ModelState.IsValid)
            {
                _context.Add(trabajadores);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Id"] = new SelectList(_context.Set <contratos>(), "Id", "Id", trabajadores.Id);
            return(View(trabajadores));
        }