private CartWithProducts MapCartWithProducts(IDataReader reader) { CartWithProducts p = new CartWithProducts(); int startingIndex = 0; p.Id = reader.GetSafeInt32(startingIndex++); p.Quantity = reader.GetSafeInt32(startingIndex++); p.Title = reader.GetSafeString(startingIndex++); p.Description = reader.GetSafeString(startingIndex++); p.BasePrice = reader.GetSafeDecimal(startingIndex++); p.Cost = reader.GetSafeDecimal(startingIndex++); p.ProductType = reader.GetSafeInt32(startingIndex++); p.MainImage = reader.GetSafeString(startingIndex++); p.SecondaryImage = reader.GetSafeString(startingIndex++); return(p); }
public List <CartWithProducts> GetHealthProductsQuantity(int productId, string userId)//get the health products addons by associated lash girl product Id { List <CartWithProducts> cartProductQuantity = null; DataProvider.ExecuteCmd(GetConnection, "dbo.Cart_GetAddOnsByProductId" , inputParamMapper : delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@UserId", userId); paramCollection.AddWithValue("@ProductId", productId); } , map : delegate(IDataReader reader, short set) { CartWithProducts p = MapCartWithProducts(reader); if (cartProductQuantity == null) { cartProductQuantity = new List <CartWithProducts>(); } cartProductQuantity.Add(p); }); return(cartProductQuantity); }