[ValidateAntiForgeryToken]//Forma para recuperar datos del Usuario
        public async Task <IActionResult> Create([Required] float MetrosCuadradosDetalle, float PrecioSemillasDetalle, string LugarCultivoDetalle, int IdCultivo)
        {
            if (ModelState.IsValid)
            {
                var user = await _userManager.GetUserAsync(User);

                var detalle = new DetalleUsersCultivo();
                {
                    detalle.UserId = await _userManager.GetUserIdAsync(user);

                    detalle.MetrosCuadradosDetalle = MetrosCuadradosDetalle;
                    detalle.PrecioSemillasDetalle  = PrecioSemillasDetalle;
                    detalle.LugarCultivoDetalle    = LugarCultivoDetalle;
                    detalle.IdCultivo = IdCultivo;
                }
                if (detalle != null)
                {
                    _context.Add(detalle);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction(nameof(Index)));
                }
            }
            return(View());
        }
        public async Task <IActionResult> Edit(int id, [Bind("IdDetalle,MetrosCuadradosDetalle,PrecioSemillasDetalle,LugarCultivoDetalle,IdCultivo")] DetalleUsersCultivo detalleUsersCultivo)
        {
            if (id != detalleUsersCultivo.IdDetalle)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(detalleUsersCultivo);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DetalleUsersCultivoExists(detalleUsersCultivo.IdDetalle))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }

            return(View(detalleUsersCultivo));
        }