I have a situation where I need to change the price on an item as it is being added to the cart. I am overriding the AddToCart in a custom DLL. When I try to access the CartRequest[0].UnitCost field either to get the value or set the value (what I need to do) I get an error:
Method Not Found: Void RazorCart.Service.Data.ModelDataContext.CartRequest.set_UnitCost(System.Decimal)'.
UnitCost is defined as a decimal in the metadata for CartRequest but it's a decimal? (null allowed) in the database. I don't think that is relevant here.
I get pretty much the same error when I am trying to read the value. Reading and writing Quantity in the same object works fine.
My code (summarized):
List<CartRequest> cartReq = context.CartRequestList.ToList();
i(I check and if there is not a cartReq[0] I return an error)
// return new ActionEndResult() { Success = false, FailureMessage = cartReq[0].UnitCost.ToString() };
decimal PriceFew = Convert.ToDecimal(cartReq[0].UnitCost);
cartReq[0].Quantity = 255.0M;
The Quantity set works fine. Nothing having to do with UnitCost works.
Is this a bug or am I doing something wrong? If I am doing something wrong do you have any suggestions on how to fix it?
Thank you,
George