public async Task <IActionResult> Edit(int id, [Bind("Id,Fecha,Valor,PuntoEstudioId")] DatosPunto datosPunto) { if (id != datosPunto.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(datosPunto); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DatosPuntoExists(datosPunto.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["PuntoEstudioId"] = new SelectList(_context.PuntoEstudios, "Id", "Id", datosPunto.PuntoEstudioId); return(View(datosPunto)); }
public async Task <IActionResult> Create([Bind("Id,Fecha,Valor,PuntoEstudioId")] DatosPunto datosPunto) { if (ModelState.IsValid) { _context.Add(datosPunto); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["PuntoEstudioId"] = new SelectList(_context.PuntoEstudios, "Id", "Id", datosPunto.PuntoEstudioId); return(View(datosPunto)); }