Exemple #1
0
        public CartModelClass GetBookCart(CartModelClass cart)
        {
            try
            {
                SqlCommand sqlCommand = new SqlCommand("GetBookCart", sqlConnection);
                sqlCommand.CommandType = CommandType.StoredProcedure;
                sqlCommand.Parameters.AddWithValue("@cartId", cart.CardId);
                sqlConnection.Open();
                SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();

                while (sqlDataReader.Read())
                {
                    cart.Quantity = Convert.ToInt32(sqlDataReader["Quantity"]);
                    cart.BookId   = Convert.ToInt32(sqlDataReader["BookId"]);
                }
                return(cart);
            }
            catch (Exception e)
            {
                throw new Exception("Value is not able to read" + e);
            }
            finally
            {
                sqlConnection.Close();
            }
        }
Exemple #2
0
        public CartModelClass DeleteCart(CartModelClass whis)
        {
            try
            {
                SqlCommand sqlCommand = new SqlCommand("sp_DeleteCart", sqlConnection);
                sqlCommand.Parameters.AddWithValue("@cartId", whis.CardId);

                sqlConnection.Open();
                sqlCommand.ExecuteNonQuery();
                sqlConnection.Close();
                return(whis);
            }
            catch (Exception e)
            {
                throw new Exception("WishList not Details Added" + e);
            }
            finally
            {
                sqlConnection.Close();
            }
        }
Exemple #3
0
 public CartModelClass UpdateCart(CartModelClass whis)
 {
     return(cart.UpdateCart(whis));
 }
Exemple #4
0
 public CartModelClass AddCart(CartModelClass whis)
 {
     return(cart.AddCart(whis));
 }
Exemple #5
0
 public CartModelClass DeleteCart(CartModelClass whis)
 {
     return(cart.DeleteCart(whis));
 }
Exemple #6
0
 public CartModelClass GetBookCart(CartModelClass carthad)
 {
     return(cart.GetBookCart(carthad));
 }