public JsonResult EditarCapitulo(CapitulosPartidasViewModel c) { JsonResult json = null; capitulosRepository = new CapitulosRepository(); try { if (capitulosRepository.Validar(c.Capitulo, out List <String> errores)) { c.Capitulo.Nombre = c.Capitulo.Nombre.ToUpper(); capitulosRepository.Update(c.Capitulo); json = Json(true); } else { String mensajes = String.Join("<br/>", errores); json = Json(mensajes); } } catch (Exception ex) { json = Json(ex.Message); } return(json); }
public async Task <IHttpActionResult> Update([FromBody] Capitulos model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { log.Info(new MDCSet(this.ControllerContext.RouteData)); await _entityRepo.Update(model); return(Ok(model)); } catch (Exception e) { log.Error(new MDCSet(this.ControllerContext.RouteData), e); return(InternalServerError(e)); } }