示例#1
0
        public async Task <IActionResult> AddToCart(GoodsIndexViewModel model, string goods, int saleId)
        {
            var splitted = goods.Split(',');
            var ids      = splitted.Select(s => Convert.ToInt32(s));

            await _goodsService.AddToCartAsync(ids, saleId, UserId);

            return(ViewComponent("Goods", new { model }));
        }
示例#2
0
        public IActionResult ClearFilter()
        {
            var model = new GoodsIndexViewModel();

            if (LocationId.HasValue)
            {
                model.LocationID = LocationId.Value;
            }

            Session.Set("goods_filter", model);

            return(ViewComponent("Goods", new { model }));
        }
#pragma warning disable 1998
        public async Task <IViewComponentResult> InvokeAsync(GoodsIndexViewModel model)
#pragma warning restore 1998
        {
            var filterDto = _mapper.Map <GoodsFilterCriteriaDto>(model);

            var result = _goodsService.GetAll(filterDto);

            var viewModel = new PaginationSet <GoodsItemViewModel>
            {
                Page       = 1,
                TotalPages = 1,
                TotalCount = 0,
                Items      = new List <GoodsItemViewModel>()
            };

            if (result.Status != ServiceResponseStatus.Success)
            {
                return(View(viewModel));
            }

            viewModel = _mapper.Map <PaginationSet <GoodsItemViewModel> >(result.Result);
            return(View(viewModel));
        }
示例#4
0
 public IActionResult Expand(GoodsIndexViewModel model)
 {
     return(ViewComponent("Goods", new { model }));
 }
示例#5
0
        public IActionResult Filter(GoodsIndexViewModel model)
        {
            Session.Set("goods_filter", model);

            return(ViewComponent("Goods", new { model }));
        }