public async Task <IActionResult> Create(PreguntaViewModel vm)
        {
            if (!ModelState.IsValid)
            {
                var cat = _categoriaRepository.GetCategorias().ToList();
                ViewBag.Categorias = new SelectList(cat, "Id", "Nombre", vm.CategoriaId);
            }
            var pathUrl = string.Empty;

            if (vm.Imagen != null && vm.Imagen.Length > 0)
            {
                var guid = Guid.NewGuid().ToString();
                var file = $"{guid}.jpg";

                pathUrl = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot\\images\\JuegosMentales", file);

                using (var stream = new FileStream(pathUrl, FileMode.Create))
                {
                    await vm.Imagen.CopyToAsync(stream);
                }

                pathUrl = $"~/images/JuegosMentales/{file}";
            }

            var pregunta = new Pregunta
            {
                CategoriaId  = vm.CategoriaId,
                Cuestionante = vm.Cuestionante,
                ImagenUrl    = pathUrl
            };

            await _repository.CreateAsync(pregunta);

            return(RedirectToAction("Index", "Home"));
        }