public IHttpActionResult UpdateMusica(int id, DTOMusica musica) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != musica.idMusica) { return(BadRequest()); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } DTOBaseResponse response = new DTOBaseResponse(); try { BusinessLogic.Controllers.MusicaController controller = new BusinessLogic.Controllers.MusicaController(); controller.UpdateMusica(id, musica); response.Success = true; } catch (Exception ex) { response.Success = false; response.Error = ex.ToString(); } return(Ok(response)); }
public IEnumerable <DTOMusica> GetAll() { BusinessLogic.Controllers.MusicaController controller = new BusinessLogic.Controllers.MusicaController(); List <DTOMusica> musicas = controller.GetAll(); return(musicas); }
// GET: api/Musica/5 public IHttpActionResult GetMusica(int id) { BusinessLogic.Controllers.MusicaController controller = new BusinessLogic.Controllers.MusicaController(); var musica = controller.GetMusica(id); if (musica == null) { return(NotFound()); } return(Ok(musica)); }
public IHttpActionResult DeleteMusica(int id) { DTOBaseResponse response = new DTOBaseResponse(); try { BusinessLogic.Controllers.MusicaController controller = new BusinessLogic.Controllers.MusicaController(); controller.DeleteMusica(id); response.Success = true; } catch (Exception ex) { response.Success = false; response.Error = ex.ToString(); } return(Ok(response)); }