public IActionResult Add([FromBody] MusicAPI mus) { try { if (mus is null) { throw new ArgumentNullException("Music Object Empty (" + where + ") (ADD)"); } if (mus.Band.Length == 0) { throw new DataException("Band Name can't be BLANK (" + where + ") (ADD)"); } if (mus.Title.Length == 0) { throw new DataException("Title can't be BLANK (" + where + ") (ADD)"); } SM.Music musa = new SM.Music(0 , mus.Band, mus.Title, mus.YEAR, mus.TRACKS, mus.NbCDs, mus.NbDvds, mus.NbLps, mus.MTypeId, mus.FormatId, mus.SerialNbr, mus.Ctry, "", "", mus.Price, mus.Curr, mus.ShopId, "", mus.Date, 1, mus.Signed, mus.SignedBy, mus.EAN, mus.EAN_EXT, mus.Comment1, mus.Comment2, mus.Onwed ); musa = S.ServiceLocator.Instance.MusicService.Add(musa); return(ApiControllerHelper.SendOk(this, new ApiResult <SM.Music>(HttpStatusCode.OK, null, musa), true)); } catch (Exception ex) { return(ApiControllerHelper.SendError(this, ex)); } }
public IActionResult Upd(int id, [FromBody] MusicAPI mus) { try { if (mus is null) { throw new ArgumentNullException("Music Object Empty (" + where + ") (UPD)"); } SM.Music musa = new SM.Music(id , mus.Band, mus.Title, mus.YEAR, mus.TRACKS, mus.NbCDs, mus.NbDvds, mus.NbLps, mus.MTypeId, mus.FormatId, mus.SerialNbr, mus.Ctry, "", "", mus.Price, mus.Curr, mus.ShopId, "", mus.Date, 1, mus.Signed, mus.SignedBy, mus.EAN, mus.EAN_EXT, mus.Comment1, mus.Comment2, mus.Onwed); bool UpdOk = S.ServiceLocator.Instance.MusicService.Upd(musa); return(ApiControllerHelper.SendOk(this, new ApiResult <bool>(HttpStatusCode.OK, null, UpdOk), HttpStatusCode.OK)); } catch (Exception ex) { return(ApiControllerHelper.SendError(this, ex)); } }
public HttpResponseMessage MV(string id = null) { return(Json(MusicAPI.MV(id))); }
public HttpResponseMessage PlayList(string id = null) { return(Json(MusicAPI.PlayList(id))); }
public HttpResponseMessage Lyric(string id) { return(Json(MusicAPI.Lyric(id))); }
public HttpResponseMessage Detail(string ids = null) { return(Json(MusicAPI.Detail(ids))); }
public HttpResponseMessage Search(string s = null, int limit = 30, int offset = 0, int type = 1) { return(Json(MusicAPI.Search(s, limit, offset, type))); }