public IActionResult GetComentarioRespuestas([FromRoute] int id) { comentariosCore = new ComentariosCore(db); List <RespuestasComentarioView> respuestas = comentariosCore.GetRespuestasComentarioViews(id); return(Ok(respuestas)); }
public IActionResult Create([FromBody] Comentarios comentario) { Claim userIdClaim = User.Claims.FirstOrDefault(x => x.Type.Contains("nameIdentifier")); string userId = userIdClaim.Value; try { comentariosCore = new ComentariosCore(db); ResponseApiError responseApiError = comentariosCore.Create(comentario, userId); if (responseApiError != null) { return(StatusCode(responseApiError.HttpStatusCode, responseApiError)); } return(Ok(new ResponseApiSuccess { Code = 1, Message = "Comentario posteado" })); } catch (Exception ex) { logger.Error(ex); return(StatusCode((int)HttpStatusCode.InternalServerError, new ResponseApiError { Code = 1001, Message = ex.Message })); } }
public IActionResult Get() { comentariosCore = new ComentariosCore(db); List <Comentarios> comentarios = comentariosCore.GetAll(); return(Ok(comentarios)); }
public IEnumerable <Comentarios> GetComentariosPublicacion(int id) { try { ComentariosCore comentariosCore = new ComentariosCore(dbContext); return(comentariosCore.GetComentariosPublicacion(id)); } catch (Exception ex) { throw ex; } }
public IActionResult DesabilitarComentario(int id) { try { ComentariosCore comentariosCore = new ComentariosCore(dbContext); comentariosCore.DesabilitarComentario(id); return(Ok("Comentario Deshabilitado con exito")); } catch (Exception ex) { return(StatusCode((int)HttpStatusCode.InternalServerError, ex)); } }
public IActionResult CreateComentario([FromBody] Comentarios comentario) { try { ComentariosCore comentariosCore = new ComentariosCore(dbContext); comentariosCore.CreateComentario(comentario); return(Ok("Comentario Agregado")); } catch (Exception ex) { return(StatusCode((int)HttpStatusCode.InternalServerError, ex)); } }
public IActionResult Delete([FromRoute] int id) { try { comentariosCore = new ComentariosCore(db); ResponseApiError responseApiError = comentariosCore.Delete(id); if (responseApiError != null) { return(StatusCode(responseApiError.HttpStatusCode, responseApiError)); } return(Ok(new ResponseApiSuccess { Code = 1, Message = "Comentario Eliminado" })); } catch (Exception ex) { logger.Error(ex); return(StatusCode((int)HttpStatusCode.InternalServerError, new ResponseApiError { Code = 1001, Message = ex.Message })); } }