Potrzebuje Waszej pomocy,musze z tych dwoch metod utworzyc jedna ale w tej drugiej ten foreach mi przeszkadza troche i nie wiem jak to do konca zrobic.
public IEnumerable<string> Get(string publikator,string rok,string numer,string str,string dodatek)
{
bool czyAkt = CzyAkt(publikator);
DataContext db = new DataContext();
var doki = from d in db.Doks
where
d.P180.Substring(0, 3) == publikator
&& d.Zeszyt.P110 == rok &&
d.Zeszyt.ZeszytP112s.Select(p => p.P112).Contains(numer) &&
d.Zeszyt.Nazwa.Substring(13,3) == dodatek
select d;
if (czyAkt)
{
doki = from d in doki
where d.Pozycja == str
select d;
}
else
{
doki = from d in doki
where d.PozycjaBezLiter == str
select d;
}
return doki.Select(d=>d.P180);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////
public void Update(string publikator, string rok, string numer, string str, string dodatek)
{
bool czyAkt = CzyAkt(publikator);
DataContext db = new DataContext();
var doki = from d in db.Doks
where
d.P180.Substring(0, 3) == publikator
&& d.Zeszyt.P110 == rok &&
d.Zeszyt.ZeszytP112s.Select(p => p.P112).Contains(numer) &&
d.Zeszyt.Nazwa.Substring(13, 3) == dodatek
select d;
if (czyAkt)
{
doki = from d in doki
where d.Pozycja == str
select d;
}
else
{
doki = from d in doki
where d.PozycjaBezLiter == str
select d;
}
foreach (var s in doki)
{
s.Status = Model.DokStatus.US;
}
db.SubmitChanges();
}