public async Task <IActionResult> Edit(int id, [Bind("Id,Nombre,Apellido")] Profesor profesor) { if (id != profesor.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(profesor); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProfesorExists(profesor.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(profesor)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Nombre,Version")] Lenguaje lenguaje) { if (id != lenguaje.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(lenguaje); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LenguajeExists(lenguaje.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(lenguaje)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,ServidorStreaming,Url")] Video video) { if (id != video.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(video); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VideoExists(video.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(video)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Titulo,ProfesorId,AnioPublicado,LenguajeId,NivelId,VideoId,Ruta,CantSubscriptos")] Curso curso) { if (id != curso.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(curso); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CursoExists(curso.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["LenguajeId"] = new SelectList(_context.Lenguajes, "Id", "Nombre", curso.LenguajeId); ViewData["NivelId"] = new SelectList(_context.Niveles, "Id", "Nombre", curso.NivelId); ViewData["VideoId"] = new SelectList(_context.Videos, "Id", "ServidorStreaming", curso.VideoId); return(View(curso)); }
public bool Edit(Notification o) { try { _context.Update(o); _context.SaveChanges(); return(true); } catch (Exception e) { return(false); } }
public bool Edit(CourseDetails o) { try { _log.LogInformation("BEGIN => Edit"); _context.Update(o); _context.SaveChanges(); _log.LogInformation("END <= Edit"); return(true); } catch (Exception e) { _log.LogError("ERROR => Edit : [%s]", e); return(false); } }
public async Task <IActionResult> Edit(int id, [Bind("Id,Email,Nombre,Apellido")] Usuario usuario, string password) { if (id != usuario.Id) { return(NotFound()); } if (!string.IsNullOrWhiteSpace(password)) { byte[] data = System.Text.Encoding.ASCII.GetBytes(password); data = new System.Security.Cryptography.SHA256Managed().ComputeHash(data); usuario.Contrasenia = data; } if (ModelState.IsValid) { try { _context.Update(usuario); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UsuarioExists(usuario.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index", "CursoUsuarios")); } return(View(usuario)); }