Пример #1
0
        public IActionResult Delete(string userid, int productid)
        {
            var result   = this.cartService.Delete(userid, productid);
            var response = new CartResultObject(result);

            response.Message = response.Result ?
                               "Successfully deleted product from cart!" :
                               "Something went wrong. Could not delete product from cart.";

            return(this.StatusCode(200, response));
        }
Пример #2
0
        public IActionResult Post([FromBody] OrdersModel order)
        {
            var result   = this.ordersService.AddOrder(order);
            var response = new CartResultObject(result);

            response.Message = response.Result ?
                               "Successfully placed order!" :
                               "Something went wrong. Could not place order.";

            return(this.StatusCode(201, response));
        }
Пример #3
0
        public IActionResult Post([FromBody] CartProductModel cart)
        {
            var result   = this.cartService.AddToCart(cart);
            var response = new CartResultObject(result);

            response.Message = response.Result ?
                               "Successfully added product to cart!" :
                               "Something went wrong. Could not add product to cart.";

            return(this.StatusCode(201, response));
        }