public ActionResult SearchAdv(string channelName, int? minAmountOfSubscribers, int? maxAmountOfSubscribers, int? minAmountOfComments, int? maxAmountOfComments, int? minAmountOfPlays, int? maxAmountOfPlays, int? minAmountOfVotes, int? maxAmountOfVotes, string sortingKey, string sortingBy, int startIndex, int endIndex, SelectedGenrePostModel genres) { Channel[] channels; ChannelSearchArgs searchArgs; using (RentItServiceClient proxy = new RentItServiceClient()) { searchArgs = proxy.GetDefaultChannelSearchArgs(); if (channelName != null && !channelName.Equals("")) searchArgs.SearchString = channelName; searchArgs.StartIndex = startIndex; searchArgs.EndIndex = endIndex; //Subscribers searchArgs.MinNumberOfSubscriptions = minAmountOfSubscribers != null ? minAmountOfSubscribers.Value : -1; searchArgs.MaxNumberOfSubscriptions = maxAmountOfSubscribers != null ? maxAmountOfSubscribers.Value : int.MaxValue; //Comments searchArgs.MinNumberOfComments = minAmountOfComments != null ? minAmountOfComments.Value : -1; searchArgs.MaxNumberOfComments = maxAmountOfComments != null ? maxAmountOfComments.Value : int.MaxValue; //Plays searchArgs.MinAmountPlayed = minAmountOfPlays != null ? minAmountOfPlays.Value : -1; searchArgs.MaxAmountPlayed = maxAmountOfPlays != null ? maxAmountOfPlays.Value : int.MaxValue; //Votes searchArgs.MinTotalVotes = minAmountOfVotes != null ? minAmountOfVotes.Value : -1; searchArgs.MaxTotalVotes = maxAmountOfVotes != null ? maxAmountOfVotes.Value : int.MaxValue; //Sorting searchArgs.SortOption = sortingKey + " " + sortingBy; searchArgs.Genres = genres.ChosenGenres != null ? genres.ChosenGenres.ToArray() : null; channels = proxy.GetChannels(searchArgs); } List<GuiChannel> guiChannels = GuiClassConverter.ConvertChannels(channels); Tuple<List<GuiChannel>, AdvancedSearchModel> model = new Tuple<List<GuiChannel>, AdvancedSearchModel>(guiChannels, (AdvancedSearchModel)searchArgs); return View("SearchResults", model); }
public ActionResult SearchResult(string searchArgs, int? userId) { if (userId.HasValue) { SelectedGenrePostModel model = new SelectedGenrePostModel(); model.ChosenGenres = null; return SearchAdv(searchArgs, null, null, null, null, null, null, null, null, "nam", "asc", 0, 10, model); using (RentItServiceClient proxy = new RentItServiceClient()) { ChannelSearchArgs channelSearchArgs = proxy.GetDefaultChannelSearchArgs(); channelSearchArgs.SearchString = searchArgs; Channel[] channels = proxy.GetChannels(channelSearchArgs); List<GuiChannel> guiChannels = GuiClassConverter.ConvertChannels(channels); ViewBag.Title = "Search results"; return View("ChannelList", guiChannels); } } return RedirectToAction("Index", "Home"); }
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"); }