示例#1
0
        public ActionResult BrandList()
        {
            BrandListViewModel vm = new BrandListViewModel();

            vm.Brands = BrandUtils.GetBrands();
            return(PartialView("~/Views/Shared/Brand/_BrandList.cshtml", vm));
        }
        public ViewViewComponentResult Invoke()
        {
            BrandListViewModel model = new BrandListViewModel
            {
                Brands       = _repo.GetAll().ToList(),
                CurrentBrand = Convert.ToInt32(HttpContext.Request.Query["brand"])
            };

            return(View(model));
        }
示例#3
0
        public ActionResult Index()
        {
            BrandListViewModel model = new BrandListViewModel
            {
                Brands = _brandService.GetBrandsList()
                         .Select(br => new BrandInfoViewModel
                {
                    Id   = br.Id,
                    Name = br.Name
                })
            };

            return(View(model));
        }
示例#4
0
        public List <BrandListViewModel> GetAllBrand()
        {
            List <BrandListViewModel> brandList = new List <BrandListViewModel>();

            _unitOfWork.Repository <Brand>().GetAll().ToList().ForEach(x =>
            {
                BrandListViewModel brand = new BrandListViewModel
                {
                    Name        = x.Name,
                    Id          = x.Id,
                    Description = x.Description
                };
                brandList.Add(brand);
            });
            return(brandList);
        }
示例#5
0
        public IActionResult Index()
        {
            var result = _brandService.GetAll();

            if (!result.Success)
            {
                return(RedirectToAction("InternalError", "Error", new { errorMessage = result.Message }));
            }

            var model = new BrandListViewModel
            {
                Brands = result.Data
            };

            return(View(model));
        }
示例#6
0
        public IActionResult GetAllBrands()
        {
            List <BrandViewModel> list   = new List <BrandViewModel>();
            HttpClient            client = new HttpClient();
            var result = client.GetAsync("https://localhost:44309/api/brand").Result;

            if (result.IsSuccessStatusCode)
            {
                list = result.Content.ReadAsAsync <List <BrandViewModel> >().Result;
            }

            var model = new BrandListViewModel()
            {
                Brands = list
            };

            return(View(model));
            //return View();
        }
        public async Task <IActionResult> Brands()
        {
            ProductInfoDto productInfo = null;

            try
            {
                productInfo = await _ProductFacade.GetCategoriesAndBrands();
            }
            catch (HttpRequestException)
            {
                _logger.LogWarning("Exception Occured using Product Facade");
                productInfo = null;
            }

            var viewModel = new BrandListViewModel()
            {
                Brands = productInfo.Brands
            };

            return(View(viewModel));
        }
示例#8
0
        public ActionResult List(BrandSearchViewModel model)
        {
            int pageIndex = model.Page ?? 1;
            var data      = _brandservice.GetList(x => (string.IsNullOrEmpty(model.BrandName) ||
                                                        x.Name.ToLower().Contains(model.BrandName.ToLower())));
            List <BrandListViewModel> list = new List <BrandListViewModel>();

            foreach (var item in data)
            {
                BrandListViewModel _brand = new BrandListViewModel();
                _brand.BrandName = item.Name;
                _brand.Id        = item.Id;
                _brand.OrderNo   = item.OrderNo;
                list.Add(_brand);
            }

            model.BrandList = list.ToPagedList(pageIndex, 10);
            if (Request.IsAjaxRequest())
            {
                return(PartialView("_BrandList", model));
            }
            return(View(model));
        }