-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Description
In Product1Controller
I get the error so How to fixed and why this error
Can you explain me sir.
public ActionResult AddToCart(int id)
{
OrderDetail OD = new OrderDetail();
OD.ProductID = id;
int Qty = 1;
decimal price = db.Products.Find(id).UnitPrice;
OD.Quantity = Qty;
OD.UnitPrice = price;
OD.TotalAmount = Qty * price;
OD.Product = db.Products.Find(id);
if (TempShpData.items == null)
{
TempShpData.items = new List<OrderDetail>();
}
TempShpData.items.Add(OD);
AddRecentViewProduct(id);
return Redirect(TempData["returnURL"].ToString());
}
System.NullReferenceException: 'Object reference not set to an instance of an object.'
System.Web.Mvc.TempDataDictionary.this[string].get returned null.
Metadata
Metadata
Assignees
Labels
No labels