public IActionResult Post([FromBody] Publication publication) { if (ModelState.IsValid) { if (!PublicationDataBase.AddPublication(publication)) { return(BadRequest()); } return(Created(Url.Action("Post", publication.Id), publication)); } return(BadRequest()); }
public IActionResult Delete(int id) { var AuxPublication = PublicationDataBase.GetPublication(id); if (AuxPublication == null) { return(NotFound()); } else if (!PublicationDataBase.DeletePublication(id)) { return(BadRequest()); } return(Ok()); }
public ActionResult <IEnumerable <Publication> > Get(int id) { try { var ListPublication = PublicationDataBase.GetAreaPublications(id); if (ListPublication == null) { return(BadRequest()); } return(Ok(ListPublication)); } catch (InvalidOperationException) { return(NotFound()); } }