// GET: Reservation public ActionResult Index() { var model = new CMS_ReservationViewModels(); try { model.ListProducts = _facProduct.GetList((byte)CMS_Common.Commons.EProductType.Procudure); model.ListCustomer = _facCus.GetList(); model.ListEmployees = _facEmp.GetList(); } catch (Exception ex) { NSLog.Logger.Error("Reservation Index", ex); } return(View(model)); }
public ActionResult Create() { CMS_OrderAdminModels model = new CMS_OrderAdminModels(); model.Items = _facPro.GetList().Select(o => new CMS_ItemModels { Price = o.ProductPrice, ProductID = o.Id, ProductName = o.ProductName, }).OrderBy(o => o.ProductName).ToList(); model.Customers = _facCus.GetList().Select(o => new CMS_CustomerAnonymousModels { FirstName = o.FirstName, LastName = o.LastName, Address = o.Address, Id = o.ID, City = o.City, Company = o.CompanyName, Country = o.Country, Email = o.Email, Phone = o.Phone, PostCode = o.Postcode }).OrderBy(o => o.Name).ToList(); model.Discounts = _facDiscount.GetList(); model.Employees = _facEmp.GetList(); return(PartialView("_Create", model)); }
// GET: Clients/Home public ActionResult Index(string id = "") { try { ProductViewModels model = new ProductViewModels(); //Product if (string.IsNullOrEmpty(id)) { model.ListProduct = _fac.GetList().OrderByDescending(x => x.CreatedDate).ToList(); } else { model.ListProduct = _fac.GetList().Where(x => x.CategoryId.Equals(id)).OrderByDescending(x => x.CreatedDate).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 = ""; } } }); } return(View(model)); } catch (Exception ex) { // NSLog.Logger.Error("Index: ", ex); return(new HttpStatusCodeResult(400, ex.Message)); } }
public ActionResult LoadGrid() { var model = _factory.GetList(ProductType); model.ForEach(x => { x.sStatus = x.IsActive ? "Kích hoạt" : "Chưa kích hoạt"; }); return(PartialView("_ListData", model)); }
public ActionResult Create() { CMS_OrderAdminModels model = new CMS_OrderAdminModels(); model.Items = _facPro.GetList().Select(o => new CMS_ItemModels { Price = o.ProductPrice, ProductID = o.Id, ProductName = o.ProductName, }).OrderBy(o => o.ProductName).ToList(); return(PartialView("_Create", model)); }
// GET: Shop public ActionResult Index() { var models = new CMS_ShopViewModels(); try { var data = _fac.GetList(); if (data != null) { models.ProductNew = data.Where(o => o.IsActive).OrderByDescending(x => x.CreatedDate).Skip(0).Take(3).ToList(); } var _cate = _facCate.GetListProductCate(); models.Products = data; models.Categories = _cate; } catch (Exception ex) { NSLog.Logger.Error("Index Shop", ex); } return(View(models)); }
// GET: Product public ActionResult Index(string product_id) { NSLog.Logger.Info("Request_Product_Index", product_id); var models = new ProductDetailViewModels(); try { if (string.IsNullOrEmpty(product_id)) { return(RedirectToAction("Index", "Home")); } var _product = _fac.GetDetail(product_id); if (_product != null) { var data = _fac.GetList().Where(o => o.ProductTypeCode == (int)CMS_Common.Commons.EProductType.Product && o.IsActive).ToList(); if (data != null) { /* get list product by category */ models.ListProduct = data.Where(o => o.CategoryId.Equals(_product.CategoryId) && !o.Id.Equals(product_id)).ToList(); /* get top 3 product new */ models.ProductNew = data.OrderByDescending(x => x.CreatedDate).Skip(0).Take(3).ToList(); /* get list product category */ var _cate = _facCate.GetListProductCate(); models.Product = _product; if (models.Product != null) { models.Product.ImageURL = models.Product.ListImages != null && models.Product.ListImages.Count > 0 ? models.Product.ListImages.FirstOrDefault().ImageURL : ""; } models.Categories = _cate; } } } catch (Exception ex) { NSLog.Logger.Error("Index Product", ex); } return(View(models)); }
// 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)); } }
public List <SelectListItem> GetListProductSelectItem(byte type = 0) { var _factory = new CMSProductFactory(); List <SelectListItem> data = null; var listCate = _factory.GetList(type); if (listCate != null) { data = listCate.Select(x => new SelectListItem { Value = x.Id, Text = x.ProductName, }).ToList(); } return(data); }
public ActionResult NewsDetail(string id) { var model = new CMS_NewsViewModel(); try { if (string.IsNullOrEmpty(id)) { return(RedirectToAction("Index", "NotFound", new { area = "Clients" })); } else { var data = _fac.GetDetail(id); if (data != null) { if (!string.IsNullOrEmpty(data.ImageURL)) { data.ImageURL = Commons.HostImage + "News/" + data.ImageURL; } } model.CMS_News = data; model.ListNewsNew = _fac.GetList().OrderByDescending(x => x.CreatedDate).Skip(0).Take(2).ToList(); if (model.ListNewsNew != null && model.ListNewsNew.Any()) { model.ListNewsNew.ForEach(x => { if (!string.IsNullOrEmpty(x.ImageURL)) { x.ImageURL = Commons.HostImage + "News/" + x.ImageURL; } else { x.ImageURL = Commons.Image870_500; } }); } //For categories model.ListCate = _facCate.GetList().OrderByDescending(x => x.CreatedDate).Skip(0).Take(5).ToList(); if (model.ListCate != null) { model.ListCate.ForEach(x => { if (!string.IsNullOrEmpty(x.ImageURL)) { x.ImageURL = Commons.HostImage + "News/" + x.ImageURL; } else { x.ImageURL = Commons.Image870_500; } }); } //For Product model.ListProduct = _facPro.GetList().OrderByDescending(x => x.CreatedDate).Skip(0).Take(5).ToList(); if (model.ListProduct != null) { model.ListProduct.ForEach(x => { if (!string.IsNullOrEmpty(x.ImageURL)) { x.ImageURL = Commons.HostImage + "News/" + x.ImageURL; } else { x.ImageURL = Commons.Image870_500; } }); } //For company infor model.CompanyInfor = _facCom.GetInfor(); if (model.CompanyInfor == null) { model.CompanyInfor = new CMS_DTO.CMSCompany.CMS_CompanyModels(); } } } catch (Exception ex) { return(RedirectToAction("Index", "NotFound", new { area = "Clients" })); } return(View(model)); }
// 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)); } }