Exemple #1
0
        public async Task <IActionResult> Search(HomeViewModel model)
        {
            var businessUnitsDTO = await this.businessUnitService
                                   .SearchBusinessUnitsAsync(model.SearchCriteria, model.CategoryId,
                                                             model.TownId);

            var townsDTO = await this.businessUnitService.GetAllTownsAsync();

            var categoriesDTO = await this.businessUnitService.GetAllBusinessUnitsCategoriesAsync();

            model.BusinessUnits = businessUnitsDTO.Select(x => x.MapFrom()).ToList();
            model.Towns         = townsDTO.Select(x => x.MapFrom()).ToList();
            model.Categories    = categoriesDTO.Select(x => x.MapFrom()).ToList();

            var businessCategories = await this.businessUnitService.GetAllBusinessUnitsCategoriesWithCountOfBusinessUnitsAsync();

            var footer = new FooterViewModel()
            {
                BusinessUnitsCategories = businessCategories
            };

            var searchModel = new BusinessUnitSearchViewModel();

            searchModel.BusinessUnits = businessUnitsDTO.Select(x => x.MapFrom()).ToList();

            return(PartialView("_BusinessUnitsPartial", searchModel));
        }
Exemple #2
0
        public async Task <IViewComponentResult> InvokeAsync()
        {
            var email = string.Empty;
            var model = new FooterViewModel
            {
                SiteName = _configuration["Site:SiteName"]
            };

            if (User.Identity.IsAuthenticated)
            {
                var user = await _userManager.GetUserAsync(HttpContext.User);

                if (user != null)
                {
                    // Si el usuario esta subscrito, no mostrara el input.
                    if (user.SubscribeArticleId > 0)
                    {
                        model.IsSubscribed = true;
                    }
                    else
                    {
                        email = user.Email;
                    }
                }
            }

            model.EmailSubscribe = email;
            return(View(model));
        }
Exemple #3
0
        public HomePageViewModel Build(int itemId)
        {
            _magazineService.IncreaseNumOfView(itemId);

            var cats = _magazineService.GetCategories();

            var mainViewModel     = new HomePageViewModel();
            var headerViewModel   = new HeaderViewModel();
            var footerViewModel   = new FooterViewModel();
            var mainPageViewModel = new MainPageViewModel();

            if (cats != null && cats.Any())
            {
                headerViewModel.Categories = cats.ToList();
                footerViewModel.Categories = cats.ToList();
            }

            mainPageViewModel.LeftColumn  = BindingDataForDetailsLeftColumnViewModel(itemId);
            mainPageViewModel.RightColumn = BindingDataForMainPageRightColumnViewModel();

            headerViewModel.SiteTitle = string.Format("Magazine Website - {0}",
                                                      ((DetailsLeftColumnViewModel)mainPageViewModel.LeftColumn).CurrentItem.ItemContent.Title);

            mainViewModel.Header    = headerViewModel;
            mainViewModel.DashBoard = new DashboardViewModel();
            mainViewModel.Footer    = footerViewModel;
            mainViewModel.MainPage  = mainPageViewModel;

            return(mainViewModel);
        }
        public ActionResult _Footer()
        {
            string      IPAddress = "";
            IPHostEntry Host      = default(IPHostEntry);
            string      Hostname  = null;

            Hostname = System.Environment.MachineName;
            Host     = Dns.GetHostEntry(Hostname);
            foreach (IPAddress IP in Host.AddressList)
            {
                if (IP.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
                {
                    IPAddress = Convert.ToString(IP);
                }
            }

            var _vm = new FooterViewModel
            {
                Usuario   = Usuario,
                IPAddress = IPAddress,
                DateTime  = DateTime.Now
            };

            return(PartialView(_vm));
        }
        public override void ExecuteResult(ControllerContext context)
        {
            try
            {
                //var cats = this._unitOfWork.Categories.GetAll().ToList();
                var cats              = this._unitOfWork.Navigations.GetNavigation();
                var mainViewModel     = new HomePageViewModel();
                var headerViewModel   = new HeaderViewModel();
                var footerViewModel   = new FooterViewModel();
                var mainPageViewModel = new MainPageViewModel();

                headerViewModel.SiteTitle = "Arcus Associates";
                if (cats != null)
                {
                    headerViewModel.Navigations         = cats;
                    headerViewModel.Categories          = cats.Select(x => x.Category).ToList();
                    headerViewModel.CurrentCategoryId   = cats.Where(x => x.Category.Name.Equals("Home", StringComparison.CurrentCultureIgnoreCase)).Select(i => i.Category.Id).First();
                    headerViewModel.CurrentCategoryName = cats.Select(x => x.Category.Name).FirstOrDefault();
                    footerViewModel.Categories          = cats.Select(x => x.Category).ToList();
                }

                mainPageViewModel.LeftColumn  = this.BindingDataForMainPageLeftColumnViewModel();
                mainPageViewModel.RightColumn = this.BindingDataForMainPageRightColumnViewModel();
                mainViewModel.Header          = headerViewModel;

                mainViewModel.Footer    = footerViewModel;
                mainViewModel.DashBoard = new DashboardViewModel();
                mainViewModel.MainPage  = mainPageViewModel;
                this.GetViewResult(mainViewModel).ExecuteResult(context);
            }
            catch (Exception exception)
            {
            }
        }
Exemple #6
0
        public ActionResult Footer()
        {
            var model     = this.viewModelFactory.GetViewModel <FooterItem>();
            var viewModel = new FooterViewModel(model, this.navigationService.GetMainNavigation());

            return(this.View(viewModel));
        }
Exemple #7
0
        public IActionResult InsertFooterContent(FooterViewModel model)
        {
            string nvm;

            if (ModelState.IsValid == false)
            {
                nvm = NotificationHandler.SerializeMessage <string>(NotificationHandler.Wrong_Values, contentRootPath);
                return(RedirectToAction("Footer", new { notification = nvm }));
            }

            try
            {
                SiteGeneralInfo footerInfo = new SiteGeneralInfo()
                {
                    Summary = model.IntroductionTitle,
                    DescriptionForFooter = model.Introduction,
                    PublicEmail          = model.Email,
                    AddressesList        = model.Address1,
                    PhoneNumbersList     = model.Phone2 == null ? model.Phone1 : $"{model.Phone1},{model.Phone2}"
                };
                dbSiteInfo.Insert(footerInfo);
            }
            catch (Exception)
            {
                nvm = NotificationHandler.SerializeMessage <string>(NotificationHandler.Failed_Insert, contentRootPath);
                return(RedirectToAction("Footer", new { notification = nvm }));
            }
            return(RedirectToAction("Footer"));
        }
Exemple #8
0
        public async Task <IViewComponentResult> InvokeAsync()
        {
            try{
                var footer       = new FooterViewModel();
                var companyModel = await Task.Factory.StartNew(() => _companyRepo.GetCompanyForHome());

                var company = new CompanyViewModel()
                {
                    Name        = companyModel.Name,
                    Address     = companyModel.Address,
                    Email       = companyModel.Email,
                    PhoneNumber = companyModel.PhoneNumber,
                    TaxCode     = companyModel.TaxCode,
                    HotLine     = companyModel.HotLine
                };
                footer.Company = company;

                var menuitemModel = await Task.Factory.StartNew(() => _postRepo.GetPostForFooter());

                var services = menuitemModel.Select(s => new MenuItemViewModel {
                    Id    = s.Id,
                    Name  = s.Name,
                    Alias = s.Alias
                }).ToList();
                footer.Service = services;

                return(View(footer));
            } catch (Exception ex)
            {
                _logger.Error(ex.Message);
                throw;
            }
        }
Exemple #9
0
        public override void ExecuteResult(ControllerContext context)
        {
            base.ExecuteResult(context);

            this._itemRepository.IncreaseNumOfView(this._itemId);

            var cats = this._categoryRepository.GetCategories();

            var mainViewModel     = new HomePageViewModel();
            var headerViewModel   = new HeaderViewModel();
            var footerViewModel   = new FooterViewModel();
            var mainPageViewModel = new MainPageViewModel();

            if (cats != null && cats.Any())
            {
                headerViewModel.Categories = cats.ToList();
                footerViewModel.Categories = cats.ToList();
            }

            mainPageViewModel.LeftColumn  = this.BindingDataForDetailsLeftColumnViewModel(this._itemId);
            mainPageViewModel.RightColumn = this.BindingDataForMainPageRightColumnViewModel();

            headerViewModel.SiteTitle = string.Format("CoinAxess Website - {0}",
                                                      ((DetailsLeftColumnViewModel)mainPageViewModel.LeftColumn).CurrentItem.ItemContent.Title);

            mainViewModel.Header    = headerViewModel;
            mainViewModel.DashBoard = new DashboardViewModel();
            mainViewModel.Footer    = footerViewModel;
            mainViewModel.MainPage  = mainPageViewModel;

            this.GetViewResult(mainViewModel).ExecuteResult(context);
        }
        public override void ExecuteResult(ControllerContext context)
        {
            base.ExecuteResult(context);

            var categories    = _categoryRepository.GetCategories();
            var subscriptions = _categoryRepository.GetUserCategories(_userIdentity.Name);//TODO: get only current user subscriptions

            var mainViewModel     = new HomePageViewModel();
            var menuViewModel     = new MainMenuViewModel();
            var footerViewModel   = new FooterViewModel();
            var mainPageViewModel = new MainPageViewModel();

            if (categories != null && categories.Any())
            {
                menuViewModel.Categories   = subscriptions.ToList();
                footerViewModel.Categories = categories.ToList();
            }

            mainPageViewModel.LeftColumn  = BindCategoryData_LeftColumnViewModel(_categoryId);
            mainPageViewModel.RightColumn = BindDataForMainPage_RightColumnViewModel();

            var news = ((CategoryLeftColumnViewModel)mainPageViewModel.LeftColumn).News;

            menuViewModel.SiteTitle = (news != null && news.Count > 0)
                ? string.Format("{0}", news.FirstOrDefault().Category.Name)
                :"Супутник НК Website";

            mainViewModel.MainMenu  = menuViewModel;
            mainViewModel.DashBoard = new DashboardViewModel();
            mainViewModel.Footer    = footerViewModel;
            mainViewModel.MainPage  = mainPageViewModel;

            GetViewResult(mainViewModel).ExecuteResult(context);
        }
        public void FinishUpdating()
        {
            LanguageRepository.Setup(x => x.GetAllLanguages(new SyncObservableCollection <Language>()));
            //LanguageRepository.Expect(x => x.GetDefaultLanguage()).Return(new Language("EN"));
            var model = new FooterViewModel();

            model.UpdateProgress(100);

            Assert.IsTrue(model.ShowProgresBar);
            Assert.AreEqual(model.TotalUpdates, 100);
            Assert.AreEqual(model.ProcessedUpdates, 0);

            model.UpdateProgress(90);

            Assert.IsTrue(model.ShowProgresBar);
            Assert.AreEqual(model.TotalUpdates, 100);
            Assert.AreEqual(model.ProcessedUpdates, 10);

            model.UpdateProgress(0);

            Assert.IsFalse(model.ShowProgresBar);
            Assert.AreEqual(model.TotalUpdates, 0);
            Assert.AreEqual(model.ProcessedUpdates, 0);

            model.Close();
        }
Exemple #12
0
        public ActionResult Contacts()
        {
            var _view_model = new FooterViewModel();

            _view_model._contact = db.Contacts.First();
            return(PartialView(_view_model));
        }
Exemple #13
0
        public ActionResult Footer()
        {
            FooterViewModel model = new FooterViewModel();

            model.Articles = Repository.Articles.All().OrderByDescending(x => x.Date).Select(x => new ArticleViewModel(x));
            return(View(model));
        }
        public override void ExecuteResult(ControllerContext context)
        {
            base.ExecuteResult(context);
            var userName             = _userIdentity.Name;
            var categories           = _categoryRepository.GetCategories();
            var subscribedCategories = _categoryRepository.GetUserCategories(userName).ToList();//TODO: get only current user subscriptions

            var mainViewModel     = new HomePageViewModel();
            var menuViewModel     = new MainMenuViewModel();
            var footerViewModel   = new FooterViewModel();
            var mainPageViewModel = new MainPageViewModel();

            menuViewModel.SiteTitle = APP_HEADER;
            if (categories != null && categories.Any())
            {
                menuViewModel.Categories   = subscribedCategories;
                footerViewModel.Categories = categories.ToList();
            }

            mainPageViewModel.LeftColumn  = this.BindingDataForMainPageLeftColumnViewModel();
            mainPageViewModel.RightColumn = this.BindingDataForMainPageRightColumnViewModel();

            mainViewModel.MainMenu  = menuViewModel;
            mainViewModel.MainPage  = mainPageViewModel;
            mainViewModel.DashBoard = new DashboardViewModel();
            mainViewModel.Footer    = footerViewModel;

            GetViewResult(mainViewModel).ExecuteResult(context);
        }
        public override void ExecuteResult(ControllerContext context)
        {
            base.ExecuteResult(context);

            _newsRepository.IncreaseNumOfView(_articleId);

            var mainViewModel     = new HomePageViewModel();
            var menuViewModel     = new MainMenuViewModel();
            var footerViewModel   = new FooterViewModel();
            var mainPageViewModel = new MainPageViewModel();

            var categories    = _categoryRepository.GetCategories();
            var subscriptions = _categoryRepository.GetUserCategories(_userIdentity.Name); //get only current user subscriptions

            if (categories != null && categories.Any())
            {
                //left menu with subscribed categories
                menuViewModel.Categories = subscriptions.ToList();

                footerViewModel.Categories = categories.ToList();
            }

            mainPageViewModel.LeftColumn  = this.BindingDataForDetailsLeftColumnViewModel(_articleId);
            mainPageViewModel.RightColumn = this.BindingDataForMainPageRightColumnViewModel();

            menuViewModel.SiteTitle = string.Format(SITE_TITLE,
                                                    ((DetailsLeftColumnViewModel)mainPageViewModel.LeftColumn).CurrentArticle.NewsContent.Title);

            mainViewModel.DashBoard = new DashboardViewModel();
            mainViewModel.MainMenu  = menuViewModel;
            mainViewModel.MainPage  = mainPageViewModel; //article content
            mainViewModel.Footer    = footerViewModel;

            GetViewResult(mainViewModel).ExecuteResult(context);
        }
Exemple #16
0
        public HomePageViewModel Build()
        {
            var cats = _magazineService.GetCategories();

            var mainViewModel     = new HomePageViewModel();
            var headerViewModel   = new HeaderViewModel();
            var footerViewModel   = new FooterViewModel();
            var mainPageViewModel = new MainPageViewModel();

            headerViewModel.SiteTitle = "Magazine Website";
            if (cats != null && cats.Any())
            {
                headerViewModel.Categories = cats.ToList();
                footerViewModel.Categories = cats.ToList();
            }

            mainPageViewModel.LeftColumn  = this.BindingDataForMainPageLeftColumnViewModel();
            mainPageViewModel.RightColumn = this.BindingDataForMainPageRightColumnViewModel();

            mainViewModel.Header    = headerViewModel;
            mainViewModel.DashBoard = new DashboardViewModel();
            mainViewModel.Footer    = footerViewModel;
            mainViewModel.MainPage  = mainPageViewModel;

            return(mainViewModel);
        }
Exemple #17
0
        public HttpResponseMessage Update(HttpRequestMessage request, FooterViewModel footerViewModel)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;
                if (!ModelState.IsValid)
                {
                    //trả về lỗi để bên ngoài bắt được sự kiện lỗi này
                    response = request.CreateResponse(HttpStatusCode.BadRequest, ModelState);
                }
                else
                {
                    Footer dbPages = _footerService.GetSingleByString(footerViewModel.ID);
                    dbPages.UpdateFooter(footerViewModel);

                    _footerService.Update(dbPages);
                    _footerService.Save();

                    var responseData = Mapper.Map <Footer, FooterViewModel>(dbPages);
                    response = request.CreateResponse(HttpStatusCode.Created, responseData);
                }

                return response;
            }));
        }
Exemple #18
0
 public HttpResponseMessage Creatte(HttpRequestMessage request, FooterViewModel footerVm)
 {
     return(CreateHttpResponse(request, () =>
     {
         if (ModelState.IsValid)
         {
             if (_footerService.GetAll() == null)
             {
                 Footer footerDb = new Footer();
                 footerDb.UpdateFooter(footerVm);
                 _footerService.Add(footerDb);
                 _footerService.SaveChange();
                 return request.CreateResponse(HttpStatusCode.Created, footerVm);
             }
             else
             {
                 return request.CreateErrorResponse(HttpStatusCode.BadRequest, "Đã tồn tại");
             }
         }
         else
         {
             return request.CreateResponse(HttpStatusCode.BadRequest, ModelState);
         }
     }));
 }
        public override void ExecuteResult(ControllerContext context)
        {
            base.ExecuteResult(context);

            var cats = this._categoryRepository.GetCategories();

            var mainViewModel     = new HomePageViewModel();
            var headerViewModel   = new HeaderViewModel();
            var footerViewModel   = new FooterViewModel();
            var mainPageViewModel = new MainPageViewModel();

            headerViewModel.SiteTitle = "Magazine Website";
            if (cats != null && cats.Any())
            {
                headerViewModel.Categories = cats.ToList();
                footerViewModel.Categories = cats.ToList();
            }

            mainPageViewModel.LeftColumn  = this.BindingDataForMainPageLeftColumnViewModel();
            mainPageViewModel.RightColumn = this.BindingDataForMainPageRightColumnViewModel();

            mainViewModel.Header    = headerViewModel;
            mainViewModel.DashBoard = new DashboardViewModel();
            mainViewModel.Footer    = footerViewModel;
            mainViewModel.MainPage  = mainPageViewModel;

            this.GetViewResult(mainViewModel).ExecuteResult(context);
        }
    /*==========================================================================================================================
    | METHOD: INVOKE (ASYNC)
    \-------------------------------------------------------------------------------------------------------------------------*/
    /// <summary>
    ///   Provides the footer menu for the site.
    /// </summary>
    public async Task<IViewComponentResult> InvokeAsync() {

      /*------------------------------------------------------------------------------------------------------------------------
      | Establish variables
      \-----------------------------------------------------------------------------------------------------------------------*/
      var navigationRootTopic   = TopicRepository.Load("Web:Company");
      var webPath               = CurrentTopic?.GetWebPath();
      var isInWeb               = CurrentTopic?.GetUniqueKey().StartsWith("Root:Web", StringComparison.OrdinalIgnoreCase);
      var navigationRoot        = CurrentTopic?.Attributes.GetValue("NavigationRoot", null, true);

      /*------------------------------------------------------------------------------------------------------------------------
      | Construct view model
      \-----------------------------------------------------------------------------------------------------------------------*/
      var navigationViewModel   = new FooterViewModel() {
        NavigationRoot          = await HierarchicalTopicMappingService.GetRootViewModelAsync(navigationRootTopic).ConfigureAwait(true),
        CurrentWebPath          = webPath,
        IsMainSite              = navigationRoot?.Equals("Web", StringComparison.OrdinalIgnoreCase)?? isInWeb?? true
      };

      /*------------------------------------------------------------------------------------------------------------------------
      | Return the corresponding view
      \-----------------------------------------------------------------------------------------------------------------------*/
      return View(navigationViewModel);

    }
        public PartialViewResult Footer(string currentPageName = "")
        {
            var footerModel = new FooterViewModel();

            footerModel.CurrentPageName = currentPageName;
            return(PartialView("~/Areas/Wap/Views/Layout/_Footer.cshtml", footerModel));
        }
Exemple #22
0
        //OutputCacheAttribute for child actions only supports Duration, VaryByCustom, and VaryByParam
        //[OutputCache(Duration = 2400, VaryByParam = "none", VaryByHeader = "host")]
        public PartialViewResult Footer()
        {
            var currentPage     = _umbracoHelper.CurrentPage;
            var footerViewModel = new FooterViewModel();

            var homePageNode = _umbracoHelper.AncenstorOrSelf(currentPage, 1);
            var homePageUrl  = homePageNode != null ? homePageNode.Url : string.Empty;

            footerViewModel.HomeUrl = homePageUrl;

            var dictionaryTerms = new FooterDictionaryViewModel();

            _umbracoMapper.MapUsingDictionary(dictionaryTerms);
            footerViewModel.SetDictionary(dictionaryTerms);

            var registerNode = _umbracoHelper.GetDescendantNodesOfType(homePageNode.Id, _nodeConfig.RegisterNodeAlias).FirstOrDefault();

            if (registerNode != null)
            {
                var registerUrl = new UrlViewModel();
                registerUrl.Name            = registerNode.Name;
                registerUrl.Url             = registerNode.Url;
                footerViewModel.RegisterUrl = registerUrl;
            }

            var homePageViewModel = new HomeViewModel();

            _umbracoMapper.Map(homePageNode, homePageViewModel);
            if (!string.IsNullOrEmpty(homePageViewModel.FooterLinks) &&
                !string.IsNullOrWhiteSpace(homePageViewModel.FooterLinks))
            {
                var homeLinks = RetrieveHomeFooterLinks(homePageViewModel.FooterLinks);
                footerViewModel.RelatedLinks = homeLinks;
            }

            var currentUser = User.Identity;

            //TODO differentiate between umbraco members and umbraco back office users: _umbracoHelper.MemberExists(User.Identity.Name)
            if (User.Identity.IsAuthenticated)
            {
                if (currentPage.DocumentTypeAlias.Equals(_nodeConfig.SiloNodeAlias))
                {
                    var links = RetrieveFooterLinks(currentPage.Id, _nodeConfig.SubSiloNodeAlias).ToList();
                    footerViewModel.Links = links;
                }
                else
                {
                    var links = RetrieveAuthenticatedFooterLinks(currentUser.GetUserName(), homePageNode.Id).ToList();
                    footerViewModel.Links = links;
                }
            }
            else
            {
                var links = RetrieveDefaultFooterLinks(homePageNode.Id, _nodeConfig.AboutGroupAlias, _nodeConfig.AboutPageAlias).ToList();
                footerViewModel.Links = links;
            }

            return(PartialView("Footer", footerViewModel));
        }
        public MainWindow(MainWindowViewModel mainWindowViewModel, HeaderViewModel headerViewModel, FooterViewModel footerViewModel)
        {
            MainWindowViewModel = mainWindowViewModel;
            HeaderViewModel     = headerViewModel;
            FooterViewModel     = footerViewModel;

            InitializeComponent();
        }
        private FooterViewModel createFooterViewModel()
        {
            FooterViewModel result = new FooterViewModel();

            result.CompanyName = "Mordor Co";
            result.Year        = DateTime.Now.Year.ToString();
            return(result);
        }
Exemple #25
0
        public PartialViewResult _Footer()
        {
            FooterViewModel model = new FooterViewModel();

            model.contactModel     = JsonConvert.DeserializeObject <List <Global> >(HttpService.Get("contact", "GetAll?TableType=" + TableType.Contact).ToString());
            model.workingHourModel = JsonConvert.DeserializeObject <List <Global> >(HttpService.Get("workinghour", "GetAll?TableType=" + TableType.WorkingHour).ToString());
            return(PartialView(model));
        }
Exemple #26
0
        public ActionResult Footer()
        {
            var             categories      = CategoryService.GetNewsByCategory(5);
            var             feedNews        = FeedNewsService.GetNewsByFeedNews(5);
            FooterViewModel footerViewModel = new FooterViewModel(categories, feedNews);

            return(PartialView("Footer", footerViewModel));
        }
Exemple #27
0
        public FooterViewModel BuildFooterViewModel(Item mainItem)
        {
            FooterViewModel footer = new FooterViewModel();

            footer.Text = mainItem.GetChildren().FirstOrDefault(x => x.Name == "Footer").Fields["Content"].Value;

            return(footer);
        }
Exemple #28
0
        public async Task <IViewComponentResult> InvokeAsync()
        {
            var footerModel = new FooterViewModel
            {
                LoginInformations = await _sessionCache.GetCurrentLoginInformationsAsync()
            };

            return(View(footerModel));
        }
Exemple #29
0
        public PartialViewResult Footer()
        {
            var footerModel = new FooterViewModel
            {
                LoginInformations = AsyncHelper.RunSync(() => _sessionCache.GetCurrentLoginInformationsAsync())
            };

            return(PartialView("_Footer", footerModel));
        }
Exemple #30
0
        public IViewComponentResult Invoke()
        {
            var model = new FooterViewModel {
                Setting    = _sRepo.Setting,
                Categories = _cRepo.Categories.Where(x => !x.Disable && x.IsMainCategory).OrderBy(x => x.Order)
            };

            return(View(model));
        }