示例#1
0
        // GET: Clients/News
        public ActionResult Index()
        {
            var model = new CMS_NewsViewModel();
            var data  = _fac.GetList().OrderByDescending(x => x.CreatedDate).ToList();

            if (data != null)
            {
                data.ForEach(x =>
                {
                    x.ImageURL = Commons.HostImage + "News/" + x.ImageURL;
                });

                model.ListNews    = data;
                model.ListNewsNew = data.OrderByDescending(x => x.CreatedDate).Skip(0).Take(5).ToList();
            }
            return(View(model));
        }
示例#2
0
 public ActionResult LoadGrid()
 {
     var model = _factory.GetList();
     model.ForEach(x =>
     {
         x.sStatus = x.IsActive ? "Kích hoạt" : "Chưa kích hoạt";
         if (!string.IsNullOrEmpty(x.ImageURL))
             x.ImageURL = Commons.HostImage + "News/" + x.ImageURL;
     });
     return PartialView("_ListData", model);
 }
示例#3
0
        // GET: Clients/Home
        public ActionResult Index()
        {
            try
            {
                ProductViewModels model = new ProductViewModels();

                //Company
                model.Company = _facCom.GetList().FirstOrDefault();

                //Category
                model.ListCate = _facCate.GetList().Where(o => o.ProductTypeCode == (int)Commons.EProductType.Procudure).OrderByDescending(x => x.CreatedDate).Skip(0).Take(3).ToList();

                //Product
                var productType = (byte)Commons.EProductType.Product;
                model.ListProduct = _fac.GetList(productType).Where(o => !string.IsNullOrEmpty(o.ImageURL)).OrderByDescending(x => x.CreatedDate).Skip(0).Take(8).ToList();

                //Procedures
                model.ListProcedures = _facProce.GetList().OrderBy(o => o.CreatedDate).Skip(0).Take(3).ToList();
                //News
                model.ListNews = _facNews.GetList().OrderByDescending(x => x.CreatedDate).Skip(0).Take(3).ToList();
                if (model.ListNews != null && model.ListNews.Any())
                {
                    model.ListNews.ForEach(x =>
                    {
                        if (!string.IsNullOrEmpty(x.ImageURL))
                        {
                            x.ImageURL = "~/Uploads/News/" + x.ImageURL;
                        }
                    });
                }

                model.ListEmployee = _facEmp.GetList().OrderBy(o => o.CreatedDate).Skip(0).Take(10).ToList();
                if (model.ListEmployee != null)
                {
                    model.ListEmployee.ForEach(o =>
                    {
                        o.ImageURL = !string.IsNullOrEmpty(o.ImageURL) ? Commons._PublicImages + "Employees/" + o.ImageURL : Commons._ImageDefault;
                    });
                }

                model.LstDiscount = _facDis.GetList(true);

                return(View(model));
            }
            catch (Exception ex)
            {
                // NSLog.Logger.Error("Index: ", ex);
                return(new HttpStatusCodeResult(400, ex.Message));
            }
        }
示例#4
0
        // GET: Blog
        public ActionResult Index()
        {
            var model = new CMS_NewsViewModel();
            var data  = _fac.GetList().OrderByDescending(x => x.CreatedDate).ToList();

            if (data != null)
            {
                data.ForEach(x =>
                {
                    x.ImageURL = Commons.HostImage + "News/" + x.ImageURL;
                });

                model.ListNews    = data;
                model.ListNewsNew = data.OrderByDescending(x => x.CreatedDate).Skip(0).Take(10).ToList();
                model.TotalBlog   = data.Count;
                var pageIndex = 0;
                if (data.Count % 10 == 0)
                {
                    pageIndex = data.Count / 10;
                }
                else
                {
                    pageIndex = Convert.ToInt32(data.Count / 10) + 1;
                }

                if (pageIndex > 1)
                {
                    model.TotalPage = 2;
                    model.IsAddMore = true;
                }
                else
                {
                    model.IsAddMore = false;
                }
            }
            return(View(model));
        }
示例#5
0
        // GET: Clients/Home
        public ActionResult Index()
        {
            try
            {
                ProductViewModels model = new ProductViewModels();

                //Company
                model.Company = _facCom.GetList().FirstOrDefault();

                //Category
                model.ListCate = _facCate.GetList().OrderByDescending(x => x.CreatedDate).Skip(0).Take(4).ToList();
                if (model.ListCate != null && model.ListCate.Any())
                {
                    model.ListCate.ForEach(x =>
                    {
                        if (!string.IsNullOrEmpty(x.ImageURL))
                        {
                            x.ImageURL = "~/Uploads/Categories/" + x.ImageURL;
                        }
                    });
                }

                //Product
                model.ListProduct = _fac.GetList().OrderByDescending(x => x.CreatedDate).Skip(0).Take(8).ToList();
                var dataImage = _fac.GetListImage();
                if (model.ListProduct != null && model.ListProduct.Any())
                {
                    model.ListProduct.ForEach(x =>
                    {
                        var _Image = dataImage.FirstOrDefault(z => z.ProductId.Equals(x.Id));
                        if (_Image != null)
                        {
                            x.ImageURL = _Image.ImageURL;
                            if (!string.IsNullOrEmpty(x.ImageURL))
                            {
                                x.ImageURL = "~/Uploads/Products/" + x.ImageURL;
                            }
                            else
                            {
                                x.ImageURL = "";
                            }
                        }
                    });
                }

                //News
                model.ListNews = _facNews.GetList().OrderByDescending(x => x.CreatedDate).Skip(0).Take(3).ToList();
                if (model.ListNews != null && model.ListNews.Any())
                {
                    model.ListNews.ForEach(x =>
                    {
                        if (!string.IsNullOrEmpty(x.ImageURL))
                        {
                            x.ImageURL = "~/Uploads/News/" + x.ImageURL;
                        }
                    });
                }
                return(View(model));
            }
            catch (Exception ex)
            {
                // NSLog.Logger.Error("Index: ", ex);
                return(new HttpStatusCodeResult(400, ex.Message));
            }
        }