public List <Model.Stavka> Resolve(FakturaBLL source, Model.Faktura destination, List <Model.Stavka> destMember, ResolutionContext context) { List <Stavka> stavke = new List <Stavka>(); foreach (var item in source.Stavke) { Stavka stavka = new Stavka(); stavka.Cijena = item.Cijena; stavka.Kolicina = item.Kolicina; stavka.Opis = item.Opis; stavka.UkupnaCijena = item.UkupnaCijena; stavke.Add(stavka); } return(stavke); }
public async Task <IActionResult> OnPostAsync(int?id) { var firma = await _context.Firma.Where(f => f.Id == id).FirstOrDefaultAsync(); var badaniaDoZafakturowania = await _context.Badanie .Where(b => b.FakturaBadanie == null && b.FirmaBadanie.FirmaId == id).ToListAsync(); var nowaFaktura = new Model.Faktura { Data = DateTime.Now, FakturaBadanieList = badaniaDoZafakturowania.Select(b => new FakturaBadanie { Badanie = b }).ToList() }; _context.Faktura.Add(nowaFaktura); await _context.SaveChangesAsync(); return(RedirectToPage("./Oczekujace")); }