Beispiel #1
0
 private HomeViewModel ToModel()
 {
     try
     {
         var model = new HomeViewModel();
         model.ListTongQuan      = _artilesService.GetDataTongQuan();
         model.TopicLienHe       = _topicService.GetByKey((int)TypeTopic.LienHe);
         model.TopicTienIch      = _topicService.GetByKey((int)TypeTopic.TienIch);
         model.TopicViTri        = _topicService.GetByKey((int)TypeTopic.ViTri);
         model.UrlMatBangTienIch = _pictureService.GetByKey((int)TypeTopic.MatBangTienIch).Url;
         model.UrlMatBangTongThe = _pictureService.GetByKey((int)TypeTopic.MatBangTongThe).Url;
         model.MatBang           = _topicService.GetByKey((int)TypeTopic.MatBang);
         model.ListSanPham       = _artilesService.GetDataSanPham();
         model.ListArticleNew    = _artilesService.GetDataTopArticle();
         model.TopicChinhSach    = _artilesService.GetByKey((int)TypeArticle.ChinhSach);
         model.email             = _configService.GetbyKey("email").Value;
         model.phone             = _configService.GetbyKey("phone").Value;
         model.logo        = _configService.GetbyKey("logo").Value;
         model.banner      = _configService.GetbyKey("banner").Value;
         model.logoarticle = _configService.GetbyKey("logoarticle").Value;
         //model.title = _configService.GetbyKey("title").Value;
         //model.Description = _configService.GetbyKey("description").Value;
         return(model);
     }
     catch
     {
         return(new HomeViewModel());
     }
 }