public static void BtnIncreaseOnClick(String BookID) { CustomerDAO dao = new CustomerDAO(); String UserID = HttpContext.Current.Session["ID"].ToString(); Customer customer = dao.GetCustomerByUserID(UserID); dao.AddNewItemToCart(customer.CustomerID, BookID); }
public static String AddBookToCart(String BookID) { CustomerDAO dao = new CustomerDAO(); if (HttpContext.Current.Session["Login"] != "Khách hàng") { return("Bạn chưa đăng nhập"); } String UserID = HttpContext.Current.Session["ID"].ToString(); Customer customer = dao.GetCustomerByUserID(UserID); dao.AddNewItemToCart(customer.CustomerID, BookID); return(JsonConvert.SerializeObject(dao.GetCustomerByUserID(UserID).Cart)); }