I have 7 methods that are the same with the exception of the Type of the object.
Here are two of them:
1)
public MyResult CreateMyResult(MyResult mi, MyVersion myv)
{
MyVersionEntity myve = _db.MyVersionEntity.Where(r => r.Id == myv.Id).First();
MyResultEntity mie = new MyResultEntity();
myve.MyResultEntityAssoc.Add(mie);
mie = _updateMyResultEntity(mi, mie);
mi.Id = mie.Id;
return mi;
}
2)
public MyIssue CreateMyIssue(MyIssue mi, MyVersion myv)
{
MyVersionEntity myve = _db.MyVersionEntity.Where(r => r.Id == myv.Id).First();
MyIssueEntity mie = new MyIssueEntity();
myve.MyIssueEntityAssoc.Add(mie);
mie = _updateMyIssueEntity(mi, mie);
mi.Id = mie.Id;
return mi;
}
Is there a way to consolidate all of them?
Thanks!
use generic that is
after call it like this