I'm calling the REST API Service /listdata.svc to delete items from my list. When I hard code my parameter, it deletes, however, I need to pass the item to delete, when I do that it fails.
here is my code
ContentItem item = dc.TrendingContent .Where(i => i.Id== id) .FirstOrDefault(); dc.DeleteObject(item); dc.SaveChanges();
If I hardcode [id] it works, but the ID is going to be passed to the function. When I do that, then the error I get refers to
item = null
am I missing something or can the parameter not be passed to this call?
this works
ContentItem item = dc.TrendingContent .Where(i => i.Id== 12) .FirstOrDefault(); dc.DeleteObject(item); dc.SaveChanges();
but the ID is going to be passed in