public async Task <IActionResult> PutNoticia(int id, datamodels.Noticia noticia) { if (id != noticia.NoticiaId) { return(BadRequest()); } try { var mapaux = _mapper.Map <datamodels.Noticia, data.Noticia>(noticia); new Solution.BS.Noticia(_context).Update(mapaux); } catch (Exception ex) { if (!NoticiaExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <datamodels.Noticia> > PostNoticia(datamodels.Noticia noticia) { var mapaux = _mapper.Map <datamodels.Noticia, data.Noticia>(noticia); new Solution.BS.Noticia(_context).Insert(mapaux); return(CreatedAtAction("GetNoticia", new { id = noticia.NoticiaId }, noticia)); }