public LanguagePageView() { NavigationPage.SetHasNavigationBar(this, false); BackgroundColor = Color.FromHex(Theme.Current.AppBackgroundColor); BindingContext = new LanguagePageViewModel(new PlatformServices()); createViews(); }
public ActionResult SnippetsByLanguage(int id, int page = 1, int count = 3) { var language = this.Data.ProgrammingLanguages.Find(id); int snippetsCount = language.Snippets.Count(); var snippets = language.Snippets .OrderByDescending(s => s.CreationTime) .ThenByDescending(s => s.Id) .Skip((page - 1) * count) .Take(count); this.ViewBag.TotalPages = (snippetsCount + count - 1) / count; this.ViewBag.CurrentPage = page; var model = new LanguagePageViewModel() { Language = Mapper.Map <LanguageSnippetViewModel>(language), Snippets = Mapper.Map <IEnumerable <SnippetsByLanguageViewModel> >(snippets) }; return(this.View(model)); }
public ActionResult Details(int id) { var languageViewModel = this.Data.ProgrammingLanguages.All() .Where(l => l.Id == id) .Select(ShortLanguageViewModel.Create) .FirstOrDefault(); var language = this.Data.ProgrammingLanguages.All() .Where(l => l.Id == id) .FirstOrDefault(); if (language == null) { return(HttpNotFound()); } var model = new LanguagePageViewModel() { Language = languageViewModel, Snippets = language.Snippets.AsQueryable().Select(ShortSnippetViewModel.Create) }; return(View(model)); }
public LanguagePage() { InitializeComponent(); BindingContext = vm = AppContainer.Instance.Resolve <LanguagePageViewModel>(); }