Пример #1
0
        public async Task <IActionResult> ConfirmOrder()
        {
            var cartsInDb = await _cartService.GetAllWithProductAsync(HttpContext.GetCookie("BerendBebeCart"));

            var orderAddDto = _mapper.Map <OrderAddDto>(new Order());

            orderAddDto.Carts = cartsInDb;

            var paymentTypesInDb = await _paymentTypeService.GetAllAsync();

            orderAddDto.PaymentTypes = paymentTypesInDb;


            return(View(orderAddDto));
        }
Пример #2
0
        public async Task <OrderViewModel> CreateAsync(OrderDto model)
        {
            var payments = await _paymentService.GetAllAsync();

            var paymentViewModels = _mapper.Map <IEnumerable <PaymentTypeViewModel> >(payments);
            var basketViewModel   = CreateBasketViewModel(model);

            var orderViewModel = new OrderViewModel
            {
                Basket   = basketViewModel,
                Payments = paymentViewModels,
            };

            return(orderViewModel);
        }
Пример #3
0
        public async Task <IActionResult> OrderDetail(int?id)
        {
            if (id == null)
            {
                return(RedirectToAction("Index").ShowMessage(Status.Error, "Hata", "Hatalı istek! Lütfen yeniden deneyiniz."));
            }

            if (!await _orderService.OrderExistsAsync(id.Value))
            {
                return(RedirectToAction("Index").ShowMessage(Status.Error, "Hata", "Sipariş bulunamadı!"));
            }

            var orderDetailDto = _mapper.Map <OrderAdminDetailDto>(await _orderService.GetByIdWithPaymentTypeAsync(id.Value));

            var paymentListInDb = await _paymentTypeService.GetAllAsync();

            ViewBag.PaymentTypes = new SelectList(paymentListInDb, "Id", "PaymentName");

            var orderDetailInDb = await _orderDetailService.GetByOrderIdAsync(id.Value);

            orderDetailDto.OrderDetails = orderDetailInDb;
            return(View(orderDetailDto));
        }
Пример #4
0
 public async Task <IActionResult> GetAll()
 => Ok(await _paymentTypeService.GetAllAsync());