public SkrivTilExcel ( |
||
match | ||
lagListe | List |
|
poster | List |
|
Результат | void |
public byte[] ToByteArray(Guid matchId) { using (var context = _dataContextFactory.Create()) { var match = context.Matcher.SingleOrDefault(x => x.MatchId == matchId); //var l1 = context.Lag.Include(x => x.Deltakere).ToList(); //var lag = (from l in context.Lag.Include(x => x.Deltakere) // join lim in context.LagIMatch on l.LagId equals lim.Lag.LagId // where lim.Match.MatchId == matchId // select l).ToList(); var lag = context.LagIMatch.Include(x => x.Lag.Deltakere) .Where(x => x.Match.MatchId == matchId) .ToList() // strange - needed to have deltakere included .Select(x => x.Lag) .ToList(); var posterIMatch = context.PosterIMatch.Include(x => x.Post).Where(x => x.Match.MatchId == matchId).ToList(); var excelMatch = MatchImport.ExcelMatch.FromMatch(match); var excelPoster = posterIMatch.Select(PostImport.ExcelPost.Create).ToList(); _excelWriter.SkrivTilExcel(excelMatch, lag, excelPoster); } return(_excelWriter.GetAsByteArray()); }
protected void Importer(MatchImport.ExcelMatch match, List<Lag> lagListe = null, List<PostImport.ExcelPost> poster = null) { _excelWriter = new ExcelWriter(); _excelWriter.SkrivTilExcel(match, lagListe, poster); Importer(); }