// edición de tipos drogas
        // GET
        public async Task<ActionResult> EdicionTiposDrogas(int? ID)
        {
            // Bad request
            if (ID == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }

            // get entity
            var _entity = await _context.DATOSPROBLEMADROGAS_DROGAS.FindAsync(ID);

            //si no existe
            if (_entity == null)
            {
                return HttpNotFound();
            }

            // set model
            var _model = new DATOSPROBLEMADROGAS_DROGASMODEL
            {
                ID = _entity.ID,
                NOMBRECIENTIFICO = _entity.NOMBRECIENTIFICO,
                NOMBRECOMUN = _entity.NOMBRECOMUN,
                DESCRIPCION = _entity.DESCRIPCION
            };

            // to view
            return View(_model);
        }
        public async Task<ActionResult> EdicionTiposDrogas(DATOSPROBLEMADROGAS_DROGASMODEL _model)
        {
            if (ModelState.IsValid)
            {
                // comprobar que el nombre científico y el común
                if (_context.DATOSPROBLEMADROGAS_DROGAS.FirstOrDefault(d => d.NOMBRECIENTIFICO == _model.NOMBRECIENTIFICO || d.NOMBRECOMUN == _model.NOMBRECOMUN && d.ID != _model.ID) != null)
                {
                    ModelState.AddModelError("", "El nombre científico o el común ya está asignado a otro registro, por favor elija otros");
                    return View(_model);
                }
                else
                {
                    try
                    {

                        // set entity
                        var _entity = new DATOSPROBLEMADROGAS_DROGAS();
                        _entity = await _context.DATOSPROBLEMADROGAS_DROGAS.FindAsync(_model.ID);

                        _entity.NOMBRECIENTIFICO = _model.NOMBRECIENTIFICO;
                        _entity.NOMBRECOMUN = _model.NOMBRECOMUN;
                        _entity.DESCRIPCION = _model.DESCRIPCION;


                        //actualizar el registro
                        _context.Entry(_entity).State = EntityState.Modified;
                        await _context.SaveChangesAsync();

                        // redireccionar
                        return RedirectToAction("TiposDrogas", "Configuraciones");

                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                }

            }
            return View(_model);
        } 
        // nuevo tipo droga
        //GET
        public ActionResult NuevoTipoDroga()
        {
            // get model
            var _model = new DATOSPROBLEMADROGAS_DROGASMODEL();

            // to view
            return View(_model);
        }