I have a variable status defined in following entity:
public class Item
{
public string ItemNumber { get; set; }
public string ItemDescription { get; set; }
public int ItemId { get; set; }
public Status status { get; set; }
}
Enum:
public enum Status
{
Approved = 1,
Received = 2,
Issued = 3,
PendingApproval = 4,
Rejected = 5,
Invoiced = 6,
Transfered = 7
}
this is the linq:
IEnumerable<Item> rpo = (from ro in _db.rpo.Where(c=> c.Id == WorkingId))
select new Items
{
ItemId = ro.Id
ItemDescription = ro.Description
ItemNum = ro.Number
ItemStatus = ro.Status
}.ToList();
I am getting this error at linq
The cast to value type 'Enum' failed because the materialized value is null. Either the result type's generic parameter or the query must use a nullable type.
Kindly let me know how to set the nullable type for the parameter
Updated the question