Esempio n. 1
0
 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);
 }