public IHttpActionResult PutDetalle(int id, Detalle detalle) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != detalle.idDetalle) { return(BadRequest()); } try { DetalleBLL.Update(detalle); return(Content(HttpStatusCode.OK, "Detalle actualizado correctamente")); } catch (Exception ex) { Detalle det = DetalleBLL.Get(id); if (det == null) { return(NotFound()); } else { return(StatusCode(HttpStatusCode.NoContent)); } } }
public IHttpActionResult GetDetalle(int id) { try { Detalle result = DetalleBLL.Get(id); if (result == null) { return(NotFound()); } return(Content(HttpStatusCode.OK, result)); } catch (Exception ex) { return(Content(HttpStatusCode.BadRequest, ex)); } }
public IHttpActionResult DeleteDetalle(int id) { Detalle detalle = DetalleBLL.Get(id); if (detalle == null) { return(NotFound()); } try { DetalleBLL.Delete(id); return(Ok("Detalle eliminado correctamente")); } catch (Exception ex) { return(Content(HttpStatusCode.BadRequest, ex)); } }