An exception error

Jul 27 2015 4:40 AM
i have a above code on my controller
public ActionResult Details(int? id)
{
var dbo = new DrugBusiness();
DrugModel dm = dbo.DetailsMethod(id);
DateTime drug_expdate = dbo.GetAll().Find(x => x.DrugId == id).ExpiryDate;
DateTime now = DateTime.Today;
var days = drug_expdate - now;
if(drug_expdate<=now)
{
ViewBag.msg = "The Drug has expired";
}
else
{
ViewBag.msg = "This Drug expires in " + days.Days + "Days";
}
return PartialView(dbo.DetailsMethod(id));
 
but when im running my Details view it's giving me an error in yellow line, this what it says "{"Object reference not set to an instance of an object."}" 
please help me ive try but nothing is working, please  
 
 

Answers (1)