public async Task <IHttpActionResult> GetById(int Id) { try{ log.Info(new MDCSet(this.ControllerContext.RouteData), new InfoException(Id)); var entity = await _entityRepo.GetById(Id); return(Ok(entity)); } catch (Exception e) { log.Error(new MDCSet(this.ControllerContext.RouteData), e); return(InternalServerError(e)); } }
public IActionResult EditarAlumno(int id) { AlumnoRepository repos = new AlumnoRepository(context); var alumno = repos.GetById(id); if (alumno == null) { return(RedirectToAction("Index")); } return(View(alumno)); }
public IActionResult EditarAlumno(Alumno a) { try { AlumnoRepository AluRepos = new AlumnoRepository(context); var usuario = AluRepos.GetById(a.Id); if (usuario != null) { usuario.Nombre = a.Nombre; usuario.NumControl = a.NumControl; // usuario.ClaveMaestro = a.ClaveMaestro; AluRepos.Update(usuario); } var claveMaestro = usuario.ClaveMaestro; return(RedirectToAction("VerAlumnos", new { clave = claveMaestro })); } catch (Exception ex) { ModelState.AddModelError("", ex.Message); return(View(a)); } }