Exemplo n.º 1
0
        // AddToBasket
        public ActionResult AddToBasket(string Id)
        {
            basketService.AddToBasket(this.HttpContext, Id);

            //return View();
            return(RedirectToAction("Index"));
        }
        public ActionResult AddToBasket(string Id)
        {
            ViewBag.IsIndexHome = false;
            basketService.AddToBasket(this.HttpContext, Id);

            return(RedirectToAction("Index", "Products"));
        }
Exemplo n.º 3
0
        public ActionResult AddToBasket(string Id, string qtyVal)
        {
            Int32.TryParse(qtyVal, out int qty);
            basketService.AddToBasket(this.HttpContext, Id, qty);

            return(RedirectToAction("Index"));
        }
        public ActionResult AddToBasket(string Id, string vin, string question)
        {
            ViewBag.IsIndexHome = false;
            basketService.AddToBasket(this.HttpContext, Id, vin, question);

            return(RedirectToAction("Index"));
        }
Exemplo n.º 5
0
 // Id에 해당하는 Product를 Basket에 추가
 public ActionResult AddToBasket(string Id)
 {
     // Product ID로 조회해서 BasketService에 추가하는 메소드 실행
     // this.HttpContext는 싱글톤으로서 Get가능
     basketService.AddToBasket(this.HttpContext, Id);
     return(RedirectToAction("Index"));
 }
        public ActionResult AddToCart(Product product, string Id, HttpPostedFileBase file)
        {
            ViewBag.IsIndexHome = false;

            basketService.AddToBasket(this.HttpContext, Id);

            return(RedirectToAction("Index"));
        }
        public async Task <IActionResult> AddToBasket([FromRoute] int id, [FromServices] IBasketService basketService)
        {
            await _productService.UpdateBasket(id, 1);

            await basketService.AddToBasket(id);

            return(RedirectToAction("Index"));
        }
        public async Task <IActionResult> AddToBasket(string user, string session, AddBasketItemRequest request)
        {
            var task = await _basketService.AddToBasket(
                user,
                session,
                new BasketItem(request.FoodId, request.FoodName, request.ImageUrl,
                               request.UnitPrice, request.Quantity));

            return(HandleTaskResult(task));
        }
Exemplo n.º 9
0
        public async Task <ActionResult> Add(int product)
        {
            var productToAdd = await productService.GetProduct(product, context);

            if (productToAdd == null)
            {
                return(Redirect("~/"));
            }

            basketService.AddToBasket(productToAdd, 1);

            return(RedirectToAction("Details"));
        }
Exemplo n.º 10
0
        public ActionResult AddToBasket(int productId)
        {
            var productToBeAdded = _productService.Get(productId);

            var basket = _basketService.GetBasketByUserId(1); //TODO: GetCartByUserID

            _basketService.AddToBasket(basket, productToBeAdded);

            ////////_cartSessionService.SetCart(cart);



            return(RedirectToAction("Index", "Home"));
        }
Exemplo n.º 11
0
        public async Task <ApiResponseModel <bool, AddToBasketReturnTypes> > AddToBasket([FromBody] AddToBasketRequestModel requestModel)
        {
            // Ürünün Basket'e eklenmesi bu metot ile gerçekleştirilmektedir
            // Burada girilen Şehir-Adet-Ürün bilgilerine göre Stock Şehir'de var mı, Min-Max Order Quantity'e uyuyor mu ve mevcut Stock var mı diye kontrol ederek
            // sepete başarı ile ekler ya da warning döner
            // Stock başarılı dönüş verirse Basket'e ekleme ve üründe Stock indirme işlemleri gerçekleştirilir
            // Kullanıcı için aktif bir Basket yok ise, bu işlemler sırasında yeni Basket oluşturulur

            var requestDto = _mapper.Map <AddToBasketRequestDto>(requestModel);
            var data       = await _basketService.AddToBasket(CurrentUserId, requestDto);

            return(new ApiResponseModel <bool, AddToBasketReturnTypes>()
            {
                IsSuccess = data.IsSuccess,
                ResponseCode = data.ResponseCode,
                ResponseMessage = data.ResponseMessage
            });
        }
Exemplo n.º 12
0
        public ActionResult AddToBasket(string Id)
        {
            basketService.AddToBasket(this.HttpContext, Id);
            //String redirect = this.HttpContext.Request["redirect"];
            //if (redirect != null)
            //{
            //    if (redirect == "Home/ProductListing")
            //    {
            //        return RedirectToAction("ProductListing", "Home");
            //    } else
            //    {
            //        return RedirectToAction("Index", "Home");
            //    }
            //} else
            //{
            //    return RedirectToAction("Index", "Home");

            //}
            return(RedirectToAction("Index"));
        }
Exemplo n.º 13
0
        public async Task <IActionResult> AddToBasket(int?id, string orderbyList, string categoryList, string pageNumber, string itemsPerPage)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var product = await _repository.GetProductById(id);

            if (product == null)
            {
                return(NotFound());
            }
            else
            {
                _basketService.AddToBasket(product);
                _logger.Log(_userManager.GetUserId(HttpContext.User), "AddToBasket");
                return(RedirectToAction("Products", "Products", new { orderbyList = orderbyList, categoryList = categoryList, pageNumber = pageNumber, itemsPerPage = itemsPerPage }));
            }
        }
        public ActionResult AddToBasket(int ID)
        {
            var Product = _ProductService.Get(ID);
            var Basket  = _BasketService.Get();

            if (Product.UnitInStock != 0)
            {
                _BasketService.AddToBasket(Basket, Product);
                _BasketService.Set(Basket);
                TempData.Add("message", String.Format("{0} isimli ürününüz başarıyla eklenmiştir.", Product.ProductName));
                TempData.Add("status", "success");
            }
            else
            {
                TempData.Add("message", String.Format("{0} isimli ürününüzün ekleme işlemi başarısız olmuştur.Bu üründen stokta bulunmuyor!!!", Product.ProductName));
                TempData.Add("status", "warning");
            }

            return(RedirectToAction("Index", "Home"));
        }
Exemplo n.º 15
0
        public ActionResult AddToBasket([FromBody] AddProductToBasketRequestModel basketItems)
        {
            _logger.LogInformation("AddToBasket service initializer");

            try
            {
                var addToBasketResult = _basketService.AddToBasket(basketItems);

                _logger.LogInformation("AddToBasket finish own operation");

                return(Ok());
            }
            catch (ProductIsNotAvailableException productIsNotAvailableException)
            {
                _logger.LogError(productIsNotAvailableException.Message);
                return(StatusCode(406, productIsNotAvailableException.Message));
            }
            catch (Exception unExpectedException)
            {
                _logger.LogError(unExpectedException.Message);

                return(StatusCode(500, unExpectedException.Message));
            }
        }
Exemplo n.º 16
0
        public bool AddToBasket(Guid hotelId, DateTime dateFrom, DateTime dateTo, int countPlaces)
        {
            var user = GetUser();

            return(basketService.AddToBasket(user, hotelId, dateFrom, dateTo, countPlaces));
        }
Exemplo n.º 17
0
        public ActionResult AddToBasket(string Id)
        {
            basketService.AddToBasket(this.HttpContext, Id);

            return(View());
        }
Exemplo n.º 18
0
 public ActionResult AddToBasket(string Id)
 {
     basketService.AddToBasket(this.HttpContext, Id);
     return(Redirect("~/Home/Index/")); //woot I did it!
 }
Exemplo n.º 19
0
        public ActionResult AddToBasket(string ProductId)
        {
            basketService.AddToBasket(this.HttpContext, ProductId);

            return(RedirectToAction("Index", "Home", null));
        }
Exemplo n.º 20
0
 public void Post([FromBody] int productId, int userId, int quantity)
 {
     _basketService.AddToBasket(productId, userId, quantity);
 }
Exemplo n.º 21
0
        public ActionResult AddToBasket(string productId)
        {
            basket_service.AddToBasket(this.HttpContext, productId);

            return(RedirectToAction("Index"));
        }
Exemplo n.º 22
0
 public ActionResult AddToBasket(string id)
 {
     basketService.AddToBasket(this.HttpContext, id);//passing the id and httpContext of current object onto AddToBasket method
     return(RedirectToAction("Index"));
 }
Exemplo n.º 23
0
        public ActionResult AddToBasket(string id)
        {
            basketService.AddToBasket(this.HttpContext, id);//always add one to the basket

            return(RedirectToAction("Index"));
        }
Exemplo n.º 24
0
 public IActionResult AddToBasket(int productId, int quantity)
 {
     _basketService.AddToBasket(_userManager.GetUserId(User), productId, quantity);
     return(RedirectToAction("Index"));
 }
Exemplo n.º 25
0
        public ActionResult AddToBasket(string id)
        {
            basketService.AddToBasket(this.HttpContext, id);

            return(RedirectToAction(nameof(Index)));
        }
Exemplo n.º 26
0
 public ActionResult AddToBasket(string Id, int Quantity)
 {
     basketService.AddToBasket(this.HttpContext, Id, Quantity);
     return(RedirectToAction("Index"));
 }
Exemplo n.º 27
0
        public async Task AddToBasket_WhenAddOneItem_ExpectOneItemInBasket()
        {
            // Arrange
            const int expected = 1;

            // Act
            _sut.ClearBasket();
            await _sut.AddToBasket(Id);

            var actual = _sut.NoOfProductsInBasket;

            // Assert
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 28
0
        public ActionResult AddToBasket(string id)
        {
            basketService.AddToBasket(HttpContext, id);

            return(RedirectToAction("Index"));
        }
Exemplo n.º 29
0
        public ActionResult AddToBasket(string Id)
        {
            basketService.AddToBasket(this.HttpContext, Id);     // Error here! "The method or operation is not implemented."

            return(RedirectToAction("index"));
        }