コード例 #1
0
        public ActionResult Create(Firma firma)
        {
            if (ModelState.IsValid)
            {
                db.Firmas.Add(firma);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.Sehir = new SelectList(db.Sehirs, "Plaka", "Sehir1", firma.Sehir);
            return View(firma);
        }
コード例 #2
0
        public ActionResult Create(Firma firma,byte Plaka)
        {
            ViewBag.SehirId = new SelectList(db.Sehirs, "Plaka", "Sehir1");
            if (ModelState.IsValid)
            {
                firma.Tip = 1;
                firma.Sehir = Plaka;
                db.Firmas.Add(firma);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(firma);
        }
コード例 #3
0
 public ActionResult Edit(Firma firma)
 {
     if (ModelState.IsValid)
     {
         db.Entry(firma).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.Sehir = new SelectList(db.Sehirs, "Plaka", "Sehir1", firma.Sehir);
     return View(firma);
 }
コード例 #4
0
        public ActionResult Login1(Firma firma)
        {
            string mail = firma.Mail;
            string sifre = firma.Sifre;

            var user = (from u in db.Firmas where u.Mail == mail select u).FirstOrDefault();
            if (user != null && (user.Mail == mail && user.Sifre == sifre))
            {
                FormsAuthentication.SetAuthCookie(mail, true);

                return RedirectToAction("Index", "Home");
            }
            else
            {
                ModelState.AddModelError("", "     Mail veya şifre hatalı!");
            }
            return View(firma);
        }