public async Task<ActionResult> EditarInstructor(TER_INSTRUCTORMODEL _model)
        {
            if (ModelState.IsValid)
            {

                try
                {
                    // comprobar la existencia del nombre
                    var _test = await _context.TER_INSTRUCTOR.FirstOrDefaultAsync(i => i.NOMBRE == _model.NOMBRE);
                    //bool _nombreRepetido = false;
                    //_nombreRepetido = (_test.ID != _model.ID && _test.NOMBRE == _model.NOMBRE) ? true : false;

                    if (_test != null)
                    {
                        if (_test.ID != _model.ID)
                        {
                            ModelState.AddModelError("", "Ya existe un registro con este nombre, por favor elija otro!");
                            return View(_model);
                        }
                        else
                        {
                            // get entity
                            var _entity = new TER_INSTRUCTOR();
                            _entity = await _context.TER_INSTRUCTOR.FindAsync(_model.ID);

                            _entity.NOMBRE = _model.NOMBRE;
                            _entity.INSTITUCION = _model.INSTITUCION;


                            // guardar en el context
                            _context.Entry(_entity).State = EntityState.Modified;
                            await _context.SaveChangesAsync();

                            // to lista de Fases
                            return RedirectToAction("Instructores", "Configuraciones");
                        }
                    }
                    else
                    {
                        // get entity
                        var _entity = new TER_INSTRUCTOR();
                        _entity = await _context.TER_INSTRUCTOR.FindAsync(_model.ID);

                        _entity.NOMBRE = _model.NOMBRE;
                        _entity.INSTITUCION = _model.INSTITUCION;


                        // guardar en el context
                        _context.Entry(_entity).State = EntityState.Modified;
                        await _context.SaveChangesAsync();

                        // to lista de Fases
                        return RedirectToAction("Instructores", "Configuraciones");
                    }


                }
                catch (Exception ex)
                {
                    ModelState.AddModelError("", ex.Message);
                    return View(_model);
                }
            }

            return View(_model);
        }
        public async Task<ActionResult> NuevoInstructor(TER_INSTRUCTORMODEL _model)
        {
            if (ModelState.IsValid)
            {

                try
                {
                    // coprobar la existencia del nombre
                    if (_context.TER_INSTRUCTOR.FirstOrDefault(i => i.NOMBRE == _model.NOMBRE) != null)
                    {
                        ModelState.AddModelError("", "Ya existe un registro con este nombre, por favor elija otro!");
                        return View(_model);
                    }
                    else
                    {
                        // get entity
                        var _entity = new TER_INSTRUCTOR
                        {
                            NOMBRE = _model.NOMBRE,
                            INSTITUCION = _model.INSTITUCION
                        };

                        // guardar en el context
                        _context.TER_INSTRUCTOR.Add(_entity);
                        await _context.SaveChangesAsync();

                        // to lista de Fases
                        return RedirectToAction("Instructores", "Configuraciones");
                    }


                }
                catch (Exception ex)
                {
                    ModelState.AddModelError("", ex.Message);
                    return View(_model);
                }
            }

            return View(_model);
        }