public HttpResponseMessage SetRatingValue(int id, MusicVoteModel vote) { Contract.Requires(vote != null); _music = new MusicData(); _music.SetRatingOnMusicTrack(id, vote.PageUserId, vote.RatingValue); return Request.CreateResponse(HttpStatusCode.NoContent); }
public void MusicRatingEnabledTest() { var data = new MusicData(); const int userId = 10; const int pageUserId = 10; const int musicId = 1231; Assert.AreEqual(false, data.TrackRatingEnabled(userId, pageUserId, musicId)); }
public HttpResponseMessage IsRatingEnabled([FromUri] MusicVoteModel id) { Contract.Requires(id != null); var pageUserId = UserData.GetUserIdFromDisplayName(HttpContext.Current.User.Identity.Name); if (pageUserId != id.PageUserId) { return Request.CreateResponse(HttpStatusCode.BadRequest, false); } _music = new MusicData(); var enabled = _music.TrackRatingEnabled(id.UserId, pageUserId, id.MusicId); return Request.CreateResponse(HttpStatusCode.OK, enabled); }
public HttpResponseMessage GetRatingValue(int id) { _music = new MusicData(); return Request.CreateResponse(HttpStatusCode.OK, _music.GetRatingForMusicTrack(id)); }
public HttpResponseMessage GetTotalVotes(int id) { _music = new MusicData(); return Request.CreateResponse(HttpStatusCode.OK, _music.GetTotalVotesForMusicTrack(id)); }