public async Task <IViewComponentResult> InvokeAsync( string title, string viewName = null) { var socialNetworks = await _websiteOptionService.GetSocialNetworksAsync(); var model = new WebsiteSocialNetworksViewModel(); if (socialNetworks != null) { model = socialNetworks.Adapt <WebsiteSocialNetworksViewModel>(); } else { model.Facebook = model.Instagram = model.LinkedIn = model.Telegram = model.Twitter = model.Whatsapp = model.YouTube = "#"; } ViewData["widget-title"] = title; if (viewName.IsNotNullOrEmpty()) { return(await Task.FromResult( View(viewName, model) )); } return(await Task.FromResult( View(model) )); }
public async Task<IViewComponentResult> InvokeAsync( int? categoryId = null, string viewName = "") { var model = new WebsiteFooterViewModel(); if (categoryId.HasValue) { } else { } model.Subscriber = new SubscriberViewModel(); var socialNetworks = await _websiteOptionService .GetSocialNetworksAsync(); if (socialNetworks != null) model.SocialNetworks = socialNetworks .Adapt<WebsiteSocialNetworksViewModel>(); var contactInfo = await _websiteOptionService.GetContactInfoAsync(); if (contactInfo != null) model.ContactInfo = contactInfo.Adapt<WebsiteContactInfoViewModel>(); if (viewName.IsNotNullOrEmpty()) return await Task.FromResult( View(viewName, model) ); return await Task.FromResult( View(model) ); }
public async Task <IViewComponentResult> InvokeAsync( string description = "", string viewName = null) { var contactInfo = await _optionService .GetContactInfoAsync(); var model = new ContactInfoWidgetViewModel { Address = contactInfo.Address1, Email = contactInfo.Email, Phones = contactInfo.Phones, Description = description }; var socialNetworks = await _optionService.GetSocialNetworksAsync(); if (socialNetworks != null) { model.SocialNetworks = socialNetworks.Adapt <WebsiteSocialNetworksViewModel>(); } if (viewName.IsNotNullOrEmpty()) { return(await Task.FromResult( View(viewName, model) )); } return(await Task.FromResult( View(model) )); }
public async Task <IViewComponentResult> InvokeAsync( string postType, string aboutText, string aboutUrl, string lang = "fa", int pageSize = 5, string viewName = "") { var model = new WebsiteFooterViewModel(); var posts = await _postService.GetLatestPostsAsync( postType, null, lang, pageSize); if (posts != null && posts.Items.Any()) { model.Posts = posts.Items.Adapt <List <PostItemViewModel> >(); } model.Subscriber = new SubscriberViewModel(); var contactInfo = await _websiteOptionService.GetContactInfoAsync(lang); //var contactInfo = _websiteOptionService.GetContactInfo(lang); if (contactInfo != null) { model.ContactInfo = contactInfo.Adapt <WebsiteContactInfoViewModel>(); } var copyrightText = await _websiteOptionService.GetOptionAsync("Copyright", lang); if (copyrightText != null) { model.CopyrightText = copyrightText.Value; } var socialNetworks = await _websiteOptionService .GetSocialNetworksAsync(); if (socialNetworks != null) { model.SocialNetworks = socialNetworks.Adapt <WebsiteSocialNetworksViewModel>(); } model.AboutText = aboutText; model.AboutUrl = aboutUrl; if (viewName.IsNotNullOrEmpty()) { return(await Task.FromResult( View(viewName, model) )); } return(await Task.FromResult( View(model) )); }
public async Task <IViewComponentResult> InvokeAsync( string actionUrl = "", string formTitle = "", string formDescription = "", string coverImageUrl = "", bool withContactInfo = false, bool withSocialNetworks = false, string viewName = null) { var model = new CreateContactViewModel { WidgetTitle = formTitle, WidgetDescription = formDescription, WidgetCoverImageUrl = coverImageUrl, WidgetActionUrl = actionUrl }; if (withContactInfo) { var contactInfo = await _websiteOptionService.GetContactInfoAsync(); if (contactInfo != null) { model.ContactInfo = contactInfo.Adapt <WebsiteContactInfoViewModel>(); } } if (withSocialNetworks) { var socialNetworks = await _websiteOptionService.GetSocialNetworksAsync(); if (socialNetworks != null) { model.SocialNetworks = socialNetworks.Adapt <WebsiteSocialNetworksViewModel>(); } } if (viewName.IsNotNullOrEmpty()) { return(await Task.FromResult( View(viewName, model) )); } return(await Task.FromResult( View(model) )); }