public BrowsePlugin(BrowseViewModel browseViewModel) { ContentView = new BrowseView { DataContext = browseViewModel }; }
public QuickRecipePage() { InitializeComponent(); Title = "Browse"; NavigationPage.SetHasNavigationBar(this, false); BindingContext = vm = new BrowseViewModel(); }
/// <summary> /// Initializes a new instance of the BrowseView class. /// </summary> public BrowseView() { InitializeComponent(); BrowseViewModel vm = (BrowseViewModel)this.DataContext; vm.CloseAction = new Action(() => this.Close()); }
public JsonResult GetJsonBestHotels(int continent, int region, string pays, int ville) { var bvm = new BrowseViewModel { Continent = continent, Region = region, Pays = pays, Ville = ville }; // TODO change to SearchResutPartialViewItem serializé ?? return(Json(SearchController.GetSearchResult(bvm) .OrderByDescending(o => o.Hotel.NbReservations) .Select(o => new { hotel = new { nom = o.Hotel.Nom, ville = o.Hotel.Villes.name.Trim(), categorie = o.Hotel.Categorie.Value, photo = o.Hotel.Photo, id = o.Hotel.IdHotel }, produits = o.Produits .Select(p => new { dateDepart = p.DateDepart.ToString("dd/MM/yyyy"), prix = p.Promotion == 0 ? p.Prix : p.PrixSolde, duree = p.Sejours.Duree }) .OrderBy(op => op.prix) } ) .Take(2).ToList(), JsonRequestBehavior.AllowGet)); }
public BrowseViewModel GetBrowseViewModel(int gamerId, int genreId) { var viewModel = new BrowseViewModel(); viewModel.Games = GetGamesByGenreForGamer(gamerId, genreId); return(viewModel); }
public ActionResult GetUsers(string filter, int page = 1) { FilterViewModel obj = FilterViewModel.ToObject(filter); var neededSkills = obj.Skills.Where(x => x.Level > 0).Select(x => new BllUserSkill { Skill = x.Skill, Level = x.Level }); IEnumerable <BllUser> users; if (neededSkills.Count() < 1) { users = userService.UsersInRole(roleService.Find(programmerRole).Id); } else { users = userService.Get(neededSkills); } var usersForPage = users.Skip((page - 1) * usersPerPage).Take(usersPerPage).Cast <BllProgrammer>(); BrowseViewModel browseModel = new BrowseViewModel { Filter = obj, Users = usersForPage.ToList(), Page = page, PageCount = (int)Math.Ceiling((double)users.Count() / usersPerPage) }; return(PartialView("_UsersPartial", browseModel)); }
/// <summary> /// Attempts to unlock the provided cheat. /// </summary> /// <param name="cheat">The cheat to unlock</param> private void UnlockCheat(Cheat cheat) { if (!this.LockedCheatList.Contains(cheat)) { throw new Exception("Cheat must be a locked cheat"); } AccessTokens accessTokens = SettingsViewModel.GetInstance().AccessTokens; // We need the unlocked cheat, since the locked one does not include the payload try { UnlockedCheat unlockedCheat = SqualrApi.UnlockCheat(accessTokens.AccessToken, cheat.CheatId); BrowseViewModel.GetInstance().SetCoinAmount(unlockedCheat.RemainingCoins); this.LockedCheatList.Remove(cheat); this.UnlockedCheatList.Insert(0, unlockedCheat.Cheat); LibraryViewModel.GetInstance().OnUnlock(unlockedCheat.Cheat); } catch (Exception ex) { OutputViewModel.GetInstance().Log(OutputViewModel.LogLevel.Error, "Error unlocking cheat", ex); } }
/// <summary> /// Selects a specific game for which to view the store. /// </summary> /// <param name="game">The selected game.</param> public void SelectGame(Game game) { // Deselect current game this.IsCheatListLoading = true; this.LockedCheatList = null; this.UnlockedCheatList = null; Task.Run(() => { try { // Select new game AccessTokens accessTokens = SettingsViewModel.GetInstance().AccessTokens; StoreCheats storeCheats = SqualrApi.GetStoreCheats(accessTokens.AccessToken, game.GameId); this.LockedCheatList = new FullyObservableCollection <Cheat>(storeCheats.LockedCheats); this.UnlockedCheatList = new FullyObservableCollection <Cheat>(storeCheats.UnlockedCheats); } catch (Exception ex) { OutputViewModel.GetInstance().Log(OutputViewModel.LogLevel.Error, "Error loading cheats", ex); BrowseViewModel.GetInstance().NavigateBack(); } finally { this.IsCheatListLoading = false; } }); }
// [Route("Browse/ByEmployer/")] // [Route("Browse/ByEmployer/{name}")] public IActionResult ByEmployer([FromQuery] string name, int?page) { if (name == null || name == string.Empty) { return(this.Redirect("/Browse/Jobs/")); } if (!page.HasValue) { page = 1; } BrowseViewModel viewModel = new BrowseViewModel() { Name = name, PagesCount = (int)Math.Ceiling(this.jobPostsService.GetJobCountByEmployer(name) / GlobalConstants.ItemsPerPage), CurrentPage = (int)page, }; viewModel.JobsDisplayViewModel = new JobsDisplayViewModel { JobPosts = this.jobPostsService.GetAllByEmployer <JobPostViewModel>(name, (int)page), }; return(this.View(viewModel)); }
public BrowsePage() { InitializeComponent(); viewModel = ViewModelLocator.Instance.BrowseViewModel; this.DataContext = viewModel; }
public ActionResult GetMorePosts(string category, int lastId) { BrowseViewModel model = new BrowseViewModel(); model.Category = category; if (category == "none") { model.Posts = _browseServcie.getAdditionalPostsFromAllLatest(lastId).ToList(); } else { model.Posts = _browseServcie.getAdditionalPostsFromCategory(category, lastId).ToList(); } if (model.Posts.Count > 0) { return(PartialView("_AdditionalPosts", model)); } else { return(null); } }
public IActionResult Search(int pageNumber, string searchText) { if (searchText != null && searchText.Length > 0) { pageNumber = pageNumber < 1 ? 1 : pageNumber; var searchTokens = searchText.ToLower().Split(" ", StringSplitOptions.RemoveEmptyEntries); var viewModel = new BrowseViewModel(); if (this.User.Identity.IsAuthenticated) { var userId = this.User.FindFirstValue(ClaimTypes.NameIdentifier); var profileId = this.profilesService.GetId(userId); viewModel.Posts = this.browseService.SearchPosts <PostViewModel>(searchTokens, pageNumber); viewModel.Items = this.browseService.GetSearchCount(searchTokens); foreach (var post in viewModel.Posts) { post.IsOwner = this.postsService.IsOwner(post.Id, profileId); post.IsLiked = this.postsService.IsLiked(post.Id, profileId); foreach (var comment in post.Comments) { comment.IsLiked = this.commentsService.IsLiked(comment.Id, profileId); } post.Comments.OrderByDescending(x => x.CreatedOn); } } else { viewModel.Posts = this.browseService.SearchPublicPosts <PostViewModel>(searchTokens, pageNumber); viewModel.Items = this.browseService.GetSearchPublicCount(searchTokens); foreach (var post in viewModel.Posts) { post.IsOwner = false; post.IsLiked = false; foreach (var comment in post.Comments) { comment.IsLiked = false; } post.Comments.OrderByDescending(x => x.CreatedOn); } } viewModel.Profiles = this.browseService.SearchProfiles <ProfileSearchViewModel>(searchTokens, pageNumber); viewModel.PageNumber = pageNumber; viewModel.ItemsPerPage = 20; return(new JsonResult(viewModel)); } return(this.BadRequest()); }
public ViewResult Latest() { BrowseViewModel model = new BrowseViewModel(); model.Posts = _browseServcie.getAllLatestItems().ToList(); return(View(model)); }
public static List <SearchResutPartialViewItem> GetSearchResult(BrowseViewModel bvm) { SearchBase s = new Search(); s = new SearchOptionDestination(s, bvm.Continent, bvm.Region, bvm.Pays, bvm.Ville); s = new SearchOptionAPartirDAujourdHui(s); return(OrderingGroupResult(s)); }
// GET: Browse public ActionResult Index() { var bvm = new BrowseViewModel(); ViewBag.BestHotels = SearchController.GetSearchResult(bvm).OrderByDescending(o => o.Hotel.NbReservations).Take(2).ToList(); return(View(bvm)); }
public BrowseController(SpotifyBrowse browseRepo, IMapper mapper, ICookieManager cookiesManager, BrowseViewModel model) { _mapper = mapper; _browseRepo = browseRepo; _model = model; _cookiesManager = cookiesManager; }
public ViewResult Index() { BrowseViewModel model = new BrowseViewModel(); //model.Posts = _browseServcie.getLatestItemsFromAllCategories().ToList(); model.Posts = _browseServcie.getAllLatestItems().ToList(); return(View("Latest", model)); }
public ViewResult Category(string category) { BrowseViewModel model = new BrowseViewModel(); model.Category = category; model.Posts = _browseServcie.getLatestItemsByCategory(category).ToList(); return(View(model)); }
/// <summary> /// Create from service model /// </summary> /// <param name="model"></param> public BrowseViewApiModel(BrowseViewModel model) { if (model == null) { throw new ArgumentNullException(nameof(model)); } ViewId = model.ViewId; Version = model.Version; Timestamp = model.Timestamp; }
public ViewResult CategoryAndTag(string category, string tag) { BrowseViewModel model = new BrowseViewModel(); model.Category = category; model.Tag = tag; model.Posts = _browseServcie.getLatestItemsByCategoryAndTag(category, tag).ToList(); return(View("Category", model)); }
public async Task <IActionResult> Browse() { BrowseViewModel browseViewModel = new BrowseViewModel(); browseViewModel.Meals = await _context.Meals .Include(m => m.MealCategories) .Include(m => m.MealIngredients) .ToListAsync(); return(View(browseViewModel)); }
public ActionResult Browse() { var model = new BrowseViewModel(); foreach (var productGroup in _cardService.ProductGroups()) { model.ProductGroups.Add(new ProductGroupViewModel(productGroup)); } return(View(model)); }
public IActionResult Browse(bool noLayout) { BrowseViewModel model = factory.CreateBrowser(); if (model == null) return NotFound(); if (noLayout) return PartialView("_Browser", model); else return View(model); }
public async Task <IActionResult> Browse() { var events = await _eventsService.ListAllEventsAsync(); var model = new BrowseViewModel { Events = _mapper.Map <IEnumerable <Event>, IEnumerable <BrowseEventViewModel> >(events), Filter = new FilterEventsViewModel() }; return(View(model)); }
public ActionResult Browse() { IEnumerable <UrlItem> items = _urlRepo.All().OrderByDescending(i => i.CreatedOn); var itemsWithLastHit = GetUrlItemsForViewModel(items); var model = new BrowseViewModel { Items = itemsWithLastHit.Take(100), TableCaption = ViewRes.Browse.TableCaptionNewest100 }; return(View(model)); }
/// <summary> /// Create from service model /// </summary> /// <param name="model"></param> public static BrowseViewApiModel ToApiModel( this BrowseViewModel model) { if (model == null) { return(null); } return(new BrowseViewApiModel { ViewId = model.ViewId, Version = model.Version, Timestamp = model.Timestamp }); }
public void BackendErrorWhenRequestingPopularMoviesTest() { try { faultyMockClient.Setup(x => x.GetPopularMovies(It.IsAny <List <Genre> >())).Throws(new BadBackendRequestException()); faultyViewModel = new BrowseViewModel(ex => { e = ex; exceptionHandled = true; }, preferences, faultyMockClient.Object); } catch { Assert.Fail(); } Assert.IsTrue(exceptionHandled); }
public List <Hotels> GetHotelsList(int continent, int region, string pays, int ville) { var bvm = new BrowseViewModel { Continent = continent, Region = region, Pays = pays, Ville = ville }; // TODO change to SearchResutPartialViewItem serializé ?? return(SearchController.GetSearchResult(bvm).Select(p => p.Hotel).ToList()); }
public ActionResult Index() { if (User.Identity.IsAuthenticated) { return(RedirectToAction("Index", "Browse")); } else { BrowseViewModel model = new BrowseViewModel(); model.Posts = _browseServcie.getLatestItemsByDate().ToList(); return(View(model)); } }
/// <summary> /// Convert diagnostics to request header /// </summary> /// <param name="viewModel"></param> /// <param name="context"></param> /// <returns></returns> public static ViewDescription ToStackModel(this BrowseViewModel viewModel, ServiceMessageContext context) { if (viewModel == null) { return(null); } return(new ViewDescription { Timestamp = viewModel.Timestamp ?? DateTime.MinValue, ViewVersion = viewModel.Version ?? 0, ViewId = viewModel.ViewId.ToNodeId(context) }); }
public ActionResult GetUsers(string filter, int page = 1) { FilterViewModel obj = FilterViewModel.ToObject(filter); var neededSkills = obj.Skills.Where(x => x.Level > 0).Select(x => new BllUserSkill { Skill = x.Skill, Level = x.Level }); IEnumerable<BllUser> users; if (neededSkills.Count() < 1) users = userService.UsersInRole(roleService.Find(programmerRole).Id); else users = userService.Get(neededSkills); var usersForPage = users.Skip((page - 1) * usersPerPage).Take(usersPerPage).Cast<BllProgrammer>(); BrowseViewModel browseModel = new BrowseViewModel { Filter = obj, Users = usersForPage.ToList(), Page = page, PageCount = (int)Math.Ceiling((double)users.Count() / usersPerPage) }; return PartialView("_UsersPartial", browseModel); }