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()); } }
public ActionResult Index() { var modelView = new MatBangViewModel(); var matBangTienIch = _pictureService.GetByKey((int)TypeTopic.MatBangTienIch); if (matBangTienIch != null) { modelView.MatBangTienIchId = matBangTienIch.id; modelView.UrlMatBangTienIch = matBangTienIch.Url; } var matBangTongThe = _pictureService.GetByKey((int)TypeTopic.MatBangTongThe); if (matBangTongThe != null) { modelView.MatBangTongTheId = matBangTongThe.id; modelView.UrlMatBangTongThe = matBangTongThe.Url; } var model = _topicService.GetByKey((int)TypeTopic.MatBang); if (model != null && model.id > 0) { modelView.MoTa = model.ShortDescription; modelView.Id = model.id; modelView.MatBangChiTiet = model.ContentDetail; } return(View(modelView)); }
public ActionResult Index() { var model = _topicService.GetByKey((int)TypeTopic.LienHe); if (model == null || model.id == 0) { model = new Topic(); model.key = (int)TypeTopic.ViTri; } return(View(model)); }
public ActionResult Index() { // var model = new TienIchViewModel(); var model = _topicService.GetByKey((int)TypeTopic.TienIch); if (model == null || model.id == 0) { model = new Topic(); model.key = (int)TypeTopic.TienIch; model.ListPicture = new List <Picture>(); } model.ListPicture.ForEach(x => x.TmpId = Guid.NewGuid().ToString()); Session["ListPicture"] = model.ListPicture; return(View(model)); }