public JsonResult GetCapitulo(Int32 Id)
        {
            JsonResult jsonResult = null;

            capitulosRepository = new CapitulosRepository();
            Capitulo capit = capitulosRepository.GetById(Id);

            if (capit == null)
            {
                jsonResult = Json(false);
            }
            else
            {
                jsonResult = Json(new
                {
                    capit.Id,
                    capit.Nombre,
                    capit.Clave,
                    capit.Eliminado,
                    capit.Partida
                }
                                  );
            }
            return(jsonResult);
        }
예제 #2
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));
            }
        }