Hi this is my first project using linq to entities. I've figured out how to create a new record I just need to get the ID that was assigned to it so I can use it as a FK in an extension table when I add the entries there. I'm allowing users to create request, the request can be for multiple pieces of equipment so I have a Request and RequestedEquipment table. Here is the code I'm using to create the request:
public void addReq(ReqType reqType, Employee reqBy, Location loc, string comm)
{
int reqID;
Request req = new Request();
req.Comments = comm;
req.Employee = reqBy;
req.ReqType = reqType;
req.RequestStatus = findReqStat(1);
req.Location = loc;
entities.AddToRequests(req);
entities.SaveChanges();
}
How can I get the ID of the request that was created so I can use it to Create the needed entries in the RequestedEquipment Table?