Пример #1
0
        public ActionResult <AddToCartResponseModel> AddToCart([FromBody] AddBookInputModel data)
        {
            AddToCartResponseModel res = new AddToCartResponseModel();

            try
            {
                BookBL bl   = new BookBL(DbContext);
                var    temp = bl.SaveCart(data);


                res.data = temp;

                if (temp.BookID == Guid.Empty)
                {
                    res.Message  = "Item ini sudah ada di list keranjang / list order";
                    res.Response = false;
                }
                else
                {
                    res.Message  = "Item berhasil ditambahkan di keranjang";
                    res.Response = true;
                }



                return(Ok(res));
            }
            catch (Exception ex)
            {
                res.Message  = ex.Message;
                res.Response = false;

                return(BadRequest(res));
            }
        }