public IActionResult AddCart()
        {
            AddCartViewModel model1 = new AddCartViewModel
            {
                ProductListModel = new List <SelectListItem>()
            };

            model1.SelectedProductName  = _mapper.Map <List <ProductPL> >(productService.GetProducts());
            model1.SelectedCustomerName = _mapper.Map <List <CustomerPL> >(customerService.GetCustomers());
            return(View(model1));
        }
        public IActionResult AddCart()
        {
            AddCartViewModel model = new AddCartViewModel
            {
                ProductListModel = new List <SelectListItem>()
            };
            var getCustomers = customerService.GetCustomers().ToList();

            model.SelectedCustomerName = objectMapper.Map <List <CustomerViewModel> >(getCustomers);
            var getProducts = productService.GetProducts().ToList();

            model.SelectedProductName = objectMapper.Map <List <ProductViewModel> >(getProducts);
            return(View(model));
        }
        public async Task <IActionResult> AddCart(AddCartViewModel model)
        {
            if (ModelState.IsValid)
            {
                var     userceId = userManager.GetUserId(HttpContext.User);
                CarCart entry    = new CarCart
                {
                    userId       = userceId,
                    carId        = model.carId,
                    RequestPrice = model.RequestPrice,
                    Telephone    = model.Telephone,
                    MeetDate     = model.MeetDate
                };
                _context.Add(entry);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index", "Home"));
            }
            return(View(model));
        }
Beispiel #4
0
        public ActionResult Index()
        {
            var model = new AddCartViewModel();

            return(View(model));
        }
        public ActionResult Index()
        {
            var viewProducts = new AddCartViewModel();

            return(View(viewProducts));
        }