public IHttpActionResult PutDetalleFavorito(int id, DetalleFavorito detalleFavorito) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != detalleFavorito.Id) { return(BadRequest()); } db.Entry(detalleFavorito).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!DetalleFavoritoExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetDetalleFavorito(int id) { DetalleFavorito detalleFavorito = db.DetalleFavoritos.Find(id); if (detalleFavorito == null) { return(NotFound()); } return(Ok(detalleFavorito)); }
public IHttpActionResult PostDetalleFavorito(DetalleFavorito detalleFavorito) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.DetalleFavoritos.Add(detalleFavorito); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = detalleFavorito.Id }, detalleFavorito)); }
public IHttpActionResult DeleteDetalleFavorito(int id) { DetalleFavorito detalleFavorito = db.DetalleFavoritos.Find(id); if (detalleFavorito == null) { return(NotFound()); } db.DetalleFavoritos.Remove(detalleFavorito); db.SaveChanges(); return(Ok(detalleFavorito)); }