Exemplo n.º 1
0
        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)
                       ));
        }
Exemplo n.º 2
0
        public async Task <IViewComponentResult> InvokeAsync()
        {
            var contactInfo = await _optionService
                              .GetContactInfoAsync();

            var model = new ContactInfoWidgetViewModel {
                Address = contactInfo.Address1,
                Email   = contactInfo.Email,
                Phones  = contactInfo.Phones
            };

            return(await Task.FromResult(
                       View(model)
                       ));
        }