public IActionResult Create(int?id) { if (HttpContext.Session.GetString("grubu") != null) { var katilim = new Katilimcilar(); katilim.Egitimid = id; var grup = _context.Firma.FirstOrDefault(b => b.Firmaid.ToString() == HttpContext.Session.GetString("firmagrubuid")); var firmalar = new List <Firma>(_context.Firma.Where(m => m.GrupId == grup.GrupId)); var katpersonel = new List <Personel>(); foreach (var i in firmalar) { var per = _context.Personel.Where(b => b.Firmaid == i.Firmaid); foreach (var j in per) { if (_context.Katilimcilar.FirstOrDefault(m => m.Sicilnop == j.Sicilnop && m.Egitimid == id) == null) { katpersonel.Add(j); } } } ViewBag.per = katpersonel; return(View(katilim)); } else { return(NotFound()); } }
public async Task <IActionResult> Create([Bind("Egitimid,Sicilnop,Basariyuzdesi")] Katilimcilar kat) { if (ModelState.IsValid) { _context.Add(kat); await _context.SaveChangesAsync(); return(RedirectToAction("Index", "Katilimcilar", new { id = kat.Egitimid })); } return(View(kat)); }