public HttpResponseMessage SubscribeToShow(int userId, int showId) { var repo = new UserShowRepo(); var result = repo.SubscribeToShow(userId, showId); return(Request.CreateAddRecordResponse(result)); }
public HttpResponseMessage GetSubscriptionsByUser(int userId) { var repo = new UserShowRepo(); var result = repo.GetSubscriptionsByUser(userId); return(Request.CreateListRecordResponse(result)); }
public HttpResponseMessage UnsubscribeToShow([FromUri] int userId, int showId) { var repo = new UserShowRepo(); var subscriptions = repo.GetSubscriptionsByUser(userId); foreach (var subscription in subscriptions) { if (subscription.ShowId == showId) { subscription.ShowId = showId; } } var result = repo.UnsubscribeUserToShow(userId, showId); return(Request.CreateUpdatedRecordResponse(result)); }