예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Categoria_LaboralId,Nombre")] Categoria_Laboral categoria_Laboral)
        {
            if (id != categoria_Laboral.Categoria_LaboralId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(categoria_Laboral);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Categoria_LaboralExists(categoria_Laboral.Categoria_LaboralId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(categoria_Laboral));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("Categoria_LaboralId,Nombre")] Categoria_Laboral categoria_Laboral)
        {
            if (ModelState.IsValid)
            {
                _context.Add(categoria_Laboral);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(categoria_Laboral));
        }