示例#1
0
                                                    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)); }
                                                    }
示例#2
0
        public IActionResult EditarAlumno(int id)
        {
            AlumnoRepository repos = new AlumnoRepository(context);
            var alumno             = repos.GetById(id);

            if (alumno == null)
            {
                return(RedirectToAction("Index"));
            }
            return(View(alumno));
        }
示例#3
0
        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));
            }
        }