예제 #1
0
        public async Task <IActionResult> AddToCart([FromBody] AddToCartModel addToCartModel)
        {
            var cartResponse = await cartServices.addToCartAsync(addToCartModel);

            // If function has any errors
            if (cartResponse.Status == "Error")
            {
                return(StatusCode(StatusCodes.Status400BadRequest, cartResponse.Message));
            }

            return(Ok(new {
                cartResponse.CartId, cartResponse.CartPrice, cartResponse.CartCount, cartResponse.CartProducts, cartResponse.Message
            }));
        }