Beispiel #1
0
 public static GuiChannel ConvertChannel(Channel c)
 {
     GuiChannel chan = new GuiChannel()
     {
         Id = c.Id,
         Description = c.Description,
         Plays = c.Hits != null ? c.Hits.Value : 0,
         Name = c.Name,
         StreamUri = c.StreamUri,
         OwnerId = c.OwnerId,
     };
     using (RentItServiceClient proxy = new RentItServiceClient())
     {
         //Get number of subscribers
         chan.Subscribers = proxy.GetSubscriberCount(chan.Id);
         //Get the channels
         chan.Tracks = ConvertTracks(proxy.GetTrackByChannelId(c.Id));
         //Get the genres
         chan.Genres = ConvertGenres(proxy.GetGenresForChannel(c.Id));
     }
     return chan;
 }
Beispiel #2
0
 public ActionResult SaveEditChannel(GuiChannel channel, int channelId, int? userId, SelectedGenrePostModel model)
 {
     if (userId.HasValue)
     {
         if (model.ChosenGenres == null) model.ChosenGenres = new List<int>();
         using (RentItServiceClient proxy = new RentItServiceClient())
         {
             proxy.UpdateChannel(channelId, userId.Value, channel.Name, channel.Description, 0.0, 0.0, model.ChosenGenres.ToArray());
         }
         return RedirectToAction("SelectChannel", "Channel", new { channelId = channelId, userId = userId });
     }
     return RedirectToAction("Index", "Home");
 }