protected override void HandleOnNavigatedTo(NavigationEventArgs e) { base.HandleOnNavigatedTo(e); if (this._isInitialized) { return; } LinksViewModel linksViewModel = new LinksViewModel(long.Parse(((Page)this).NavigationContext.QueryString["CommunityId"])); ((FrameworkElement)this).DataContext = ((object)linksViewModel); ApplicationBarIconButton applicationBarIconButton1 = new ApplicationBarIconButton(); Uri uri = new Uri("/Resources/appbar.add.rest.png", UriKind.Relative); applicationBarIconButton1.IconUri = (uri); string appBarAdd = CommonResources.AppBar_Add; applicationBarIconButton1.Text = (appBarAdd); ApplicationBarIconButton applicationBarIconButton2 = applicationBarIconButton1; applicationBarIconButton2.Click += ((EventHandler)((p, f) => Navigator.Current.NavigateToCommunityManagementLinkCreation(this.ViewModel.CommunityId, (GroupLink)null))); this.ApplicationBar = ((IApplicationBar)ApplicationBarBuilder.Build(new Color?(), new Color?(), 0.9)); this.ApplicationBar.Buttons.Add((object)applicationBarIconButton2); linksViewModel.Links.LoadData(true, false, (Action <BackendResult <System.Collections.Generic.List <Group>, ResultCode> >)null, false); this._isInitialized = true; }
public ActionResult Links() { var model = new LinksViewModel(); model.FirstParameter = "pizza"; model.SecondParameter = "pie"; return(View(model)); }
public IActionResult CheckStatus(LinksViewModel model) { if (ModelState.IsValid && model.InputLinks != null && model.Links.Any()) { return(View("StatusView", model)); } return(RedirectToAction("Index")); }
public ActionResult Links() { var viewModel = new LinksViewModel(); viewModel.Links = _siteMetaData.Links; return(View(viewModel)); }
private void LinkColumnsList_SelectionChanged(object sender, SelectionChangedEventArgs e) { LinksViewModel viewModel = (LinksViewModel)DataContext; List <BusinessKeyViewModel>?columns = columnsListNew.SelectedItems.Cast <BusinessKeyViewModel>().ToList(); viewModel.SelectedLinkColumns = columns; viewModel.SelectedLinkColumn = columns.FirstOrDefault(); }
public ShellViewModel() { var eventAggregator = new EventAggregator(); var navigationService = new NavigationService(eventAggregator); eventAggregator.Subscribe(this); Widget = new AddressBarViewModel(eventAggregator, navigationService); SideBar = new LinksViewModel(navigationService); }
public IActionResult Index() { var model = new LinksViewModel() { Links = LinkList.GetAllLinks() }; return(View(model)); }
public ActionResult Index() { var viewmodel = new LinksViewModel(); viewmodel.linklists = MASTERdomain.linklists.ToModel(); // handle linktype options var selectOptions = new Dictionary <string, IEnumerable <string[]> >(); foreach (LinkType value in Enum.GetValues(typeof(LinkType))) { switch (value) { case LinkType.BLOG: var blogs = MASTERdomain.blogs.Select(x => new[] { x.title, x.id.ToString() }); selectOptions.Add(LinkType.BLOG.ToString(), blogs); break; case LinkType.FRONTPAGE: // nothing break; case LinkType.COLLECTION: var collections = MASTERdomain.product_collections.Select(x => new[] { x.name, x.id.ToString() }); selectOptions.Add(LinkType.COLLECTION.ToString(), collections); break; case LinkType.PAGE: var pages = MASTERdomain.pages.Select(x => new[] { x.name, x.id.ToString() }); selectOptions.Add(LinkType.PAGE.ToString(), pages); break; case LinkType.PRODUCT: var products = MASTERdomain.products .OrderByDescending(x => x.id) .Take(100) .Select(x => new[] { x.title, x.id.ToString() }); selectOptions.Add(LinkType.PRODUCT.ToString(), products); break; case LinkType.SEARCHPAGE: break; case LinkType.WEB: break; default: throw new ArgumentOutOfRangeException(); } } var serializer = new JavaScriptSerializer(); var jsonstring = serializer.Serialize(selectOptions); viewmodel.selectablesString = jsonstring; return(View(viewmodel)); }
public IActionResult Links(Area district, string exchange, string ne) { var model = new LinksViewModel() { Misc = repository.Miscs.OrderBy(x => x.Name).ToArray(), NE = repository.GetLinks(ne) }; return(View("Links", model)); }
public ActionResult GetLink(int id) { var links = Service.GetLinks(); var link = links.FirstOrDefault(x => x.Id == id); var model = new LinksViewModel { Id = link.Id, LinkName = link.LinkName, LinkEndpoint = new Uri(link.LinkEndpoint) }; return(PartialView("_Link", model)); }
public ActionResult Index() { var viewModel = new LinksViewModel(); using (var client = new HttpClient { BaseAddress = new Uri(_baseApiUrl) }) { var response = client.GetAsync("").Result; if (response.StatusCode == HttpStatusCode.OK) { viewModel.Links = JsonConvert.DeserializeObject <List <Link> >(response.Content.ReadAsStringAsync().Result); } } return(View(viewModel)); }
public ActionResult UpdateLink(LinksViewModel config) { if (!ModelState.IsValid) { return(RedirectToAction("Index")); } var dto = new LinksConfigurationDto { Id = config.Id, LinkName = config.LinkName, LinkEndpoint = config.LinkEndpoint.ToString() }; var result = Service.UpdateLink(dto); if (result) { return(RedirectToAction("Index")); } return(View("Error")); }
public ProductViewModel(ProductDataModel product) { _product = product; if (!_product.Stores.Contains(0)) { _product.Stores.Add(0); // Default store ID } DataVM = new DataViewModel(product); LinksVM = new LinksViewModel(product); DiscountsVM = new DiscountsViewModel(product); OffersVM = new OffersViewModel(product); ImagesVM = new ImagesViewModel(product); LoadCommand = new CommandHandler(o => Load()); SaveCommand = new CommandHandler(o => Save()); RemoveCommand = new CommandHandler(o => RemoveItem(o)); BackCommand = new CommandHandler(o => BackTo()); }
public virtual async Task <IActionResult> OnGetAsync(Guid pageId) { var page = await _webPagesService.FindByIdAllIncludedAsync(pageId); if (page == null) { return(NotFound()); } PageTitle = await TranslationsService.TranslateAsync("Links"); TxtAddLink = await TranslationsService.TranslateAsync("Add Link"); NameDisplay = await TranslationsService.TranslateAsync("name"); LinkNameRequiredError = TranslationsService.TranslateErrorByDescriber(ErrorDescriberConstants.RequiredField, $"The field '{NameDisplay}' is required.", NameDisplay); LinkNameLengthError = TranslationsService.TranslateErrorByDescriber(ErrorDescriberConstants.StringLength, $"The field '{NameDisplay}' must contain a minimum of {4} and a maximum of {30} characters.", NameDisplay, 4.ToString(), 30.ToString()); LinkUrlRequiredError = TranslationsService.TranslateErrorByDescriber(ErrorDescriberConstants.StringLength, $"The field 'Url' must contain a minimum of {4} and a maximum of {200} characters.", "Url", 4.ToString(), 200.ToString()); TxtAddedOn = await TranslationsService.TranslateAsync("Toegevoegd op"); ViewData["PageId"] = page.Id; Vm = new LinksViewModel { PageId = page.Id }; if (page.Links.Count > 0) { Vm.Links = page.Links.OrderBy(l => l.UniqueNameIdentifier).Select(l => new LinkDto { Id = l.Id, Name = l?.Name, Url = l?.Url, DateTimeCreated = $"{l.DateTimeCreated?.ToShortDateString()} - ({l.DateTimeCreated?.ToShortTimeString()})" }).ToList(); } return(Page()); }
public Links() { InitializeComponent(); DataContext = new LinksViewModel(); }
public static Link ToEntity(this LinksViewModel model) { return(model.MapTo <LinksViewModel, Link>()); }
public static Link ToEntity(this LinksViewModel model, Link entity) { return(model.MapTo(entity)); }
public ActionResult Links(LinksViewModel model) { return(View(model)); }
public ShellViewModel(IEventAggregator eventAggregator, LinksViewModel linksViewModel, AddressBarViewModel addressBarViewModel) { eventAggregator.Subscribe(this); Widget = addressBarViewModel; SideBar = linksViewModel; }