public ActionResult KullaniciOlusturma() { KullaniciDBEntities db = new KullaniciDBEntities(); List <Kisi> kL = db.Kisi.ToList(); ViewBag.kisiList = new SelectList(kL, "AdSoyad", "Email", "Yas", "Konum", "Telefon", "Parola"); return(View()); }
public ActionResult SoruKullaniciSecme() { KullaniciDBEntities db = new KullaniciDBEntities(); List <SelectListItem> kisi = new List <SelectListItem>(); Random rand = new Random(); int id = rand.Next(db.Kisi.ToList().Count); int i = 0; foreach (var item in db.Kisi.ToList()) { kisi.Add(new SelectListItem { Text = item.AdSoyad, Value = item.ID.ToString(), Selected = false }); } ViewBag.kisiler = kisi; Random rnd = new Random(); int r = rnd.Next(ViewBag.kisiler.Count); TempData["r"] = r; TempData["kisi"] = kisi; List <SelectListItem> soru = new List <SelectListItem>(); foreach (var item in db.Soru.ToList()) { soru.Add(new SelectListItem { Text = item.SoruAd, Value = item.ID.ToString() }); } ViewBag.sorular = soru; Random x = new Random(); int y = rnd.Next(ViewBag.sorular.Count); TempData["y"] = y; return(View()); }
public ActionResult KullaniciOlusturma(List <Kisi> modelList) { KullaniciDBEntities db = new KullaniciDBEntities(); List <Kisi> eklenenList = new List <Kisi>(); foreach (Kisi model in modelList) { Kisi k = new Kisi(); k.ID = model.ID; k.AdSoyad = model.AdSoyad; k.Email = model.Email; k.Yas = model.Yas; k.Konum = model.Konum; k.Telefon = model.Telefon; k.Parola = model.Parola; db.Kisi.Add(k); db.SaveChanges(); eklenenList.Add(k); } return(RedirectToAction("KullaniciListeleme", eklenenList)); }