Beispiel #1
0
 public ActionResult Create()
 {
     using (OIDbEntities db = new OIDbEntities())
     {
         KullanıcıVM user = new KullanıcıVM()
         {
             Ogretmenlers = db.Ogretmenlers.ToList()
         };
         return(View(user));
     }
 }
Beispiel #2
0
        public ActionResult Create(KullanıcıVM model)
        {
            using (OIDbEntities db = new OIDbEntities())
            {
                if (!ModelState.IsValid)
                {
                    KullanıcıVM user = new KullanıcıVM()
                    {
                        Kullanıcılar = model.Kullanıcılar,
                        Ogretmenlers = db.Ogretmenlers.ToList()
                    };
                    return(View(user));
                }

                db.Kullanıcılar.Add(model.Kullanıcılar);
                db.SaveChanges();
                return(RedirectToAction("List"));
            }
        }