Пример #1
0
        public ActionResult Create(uye Uye, HttpPostedFileBase foto)

        {
            if (ModelState.IsValid)
            {
                if (foto != null)
                {
                    WebImage img      = new WebImage(foto.InputStream);
                    FileInfo fotoinfo = new FileInfo(foto.FileName);
                    string   newfoto  = Guid.NewGuid().ToString() + fotoinfo.Extension;
                    img.Resize(150, 150);
                    img.Save("~/Uploads/uyefoto/" + newfoto);
                    Uye.foto    = "/Uploads/uyefoto/" + newfoto;
                    Uye.yetkiid = 2;
                    db.uyes.Add(Uye);
                    db.SaveChanges();
                    Session["UyeId"]        = Uye.uyeid;
                    Session["KullaniciAdi"] = Uye.kullaniciadi;
                    return(RedirectToAction("Index", "Home"));
                }

                else
                {
                    ModelState.AddModelError("Fotoğraf", "Fotoğraf Seçiniz");
                }
            }
            return(View(Uye));
        }
Пример #2
0
        public ActionResult Edit(uye Uye, int id, HttpPostedFileBase foto)
        {
            if (ModelState.IsValid)
            {
                var uye = db.uyes.Where(u => u.uyeid == id).SingleOrDefault();

                if (foto != null)
                {
                    if (System.IO.File.Exists(Server.MapPath(uye.foto)))
                    {
                        System.IO.File.Delete(Server.MapPath(uye.foto));
                    }

                    WebImage img      = new WebImage(foto.InputStream);
                    FileInfo fotoInfo = new FileInfo(foto.FileName);

                    string newfoto = Guid.NewGuid().ToString() + fotoInfo.Extension;
                    img.Resize(150, 150);
                    img.Save("~/Uploads/uyefoto/" + newfoto);
                    uye.foto = "/Uploads/uyefoto/" + newfoto;
                }
                uye.adsoyad      = Uye.adsoyad;
                uye.kullaniciadi = Uye.kullaniciadi;
                uye.sifre        = Uye.sifre;
                uye.email        = Uye.email;
                db.SaveChanges();
                Session["kullaniciadi"] = uye.kullaniciadi;
                return(RedirectToAction("Index", "Home", new { id = uye.uyeid }));
            }
            return(View());
        }
Пример #3
0
 public ActionResult Edit(uye uye, int id)
 {
     if (ModelState.IsValid)
     {
         var uyee = db.uyes.Where(u => u.uyeId == id).SingleOrDefault();
         if (uye != null)
         {
             uyee.kullaniciAdi = uye.kullaniciAdi;
             uyee.adi          = uye.adi;
             uyee.soyadi       = uye.soyadi;
             uyee.sifre        = uye.sifre;
             uyee.email        = uye.email;
             db.SaveChanges();
             Session["kullaniciadi"] = uye.kullaniciAdi;
             return(RedirectToAction("Index", new { id = uyee.uyeId }));
         }
         else
         {
             uyee.kullaniciAdi = uye.kullaniciAdi;
             uyee.adi          = uye.adi;
             uyee.soyadi       = uye.soyadi;
             uyee.sifre        = uye.sifre;
             uyee.email        = uye.email;
             db.SaveChanges();
             Session["kullaniciadi"] = uye.kullaniciAdi;
             return(RedirectToAction("Index", new { id = uyee.uyeId }));
         }
     }
     return(View());
 }
Пример #4
0
        public ActionResult DeleteConfirmed(int id)
        {
            uye uye = db.uyes.Find(id);

            db.uyes.Remove(uye);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #5
0
 public ActionResult Edit([Bind(Include = "uyeId,kullaniciAdi,email,sifre,adi,soyadi,yetkiId")] uye uye)
 {
     if (ModelState.IsValid)
     {
         db.Entry(uye).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.yetkiId = new SelectList(db.yetkis, "yetkiId", "yetki1", uye.yetkiId);
     return(View(uye));
 }
Пример #6
0
        public ActionResult giris(uye model)
        {
            var Kullanici = db.uye.FirstOrDefault(x => x.k_ad == model.k_ad);

            if (Kullanici != null)
            {
                Session["cins"] = "Admin";
                return(RedirectToAction("Index", "Admin"));
            }
            return(View());
        }
        public ActionResult Create([Bind(Include = "uyeid,kullaniciadi,email,sifre,adsoyad,foto,yetkiid")] uye uye)
        {
            if (ModelState.IsValid)
            {
                db.uyes.Add(uye);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.yetkiid = new SelectList(db.yetkis, "yetkiid", "yetki1", uye.yetkiid);
            return(View(uye));
        }
Пример #8
0
        // GET: AdminUye/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            uye uye = db.uyes.Find(id);

            if (uye == null)
            {
                return(HttpNotFound());
            }
            return(View(uye));
        }
Пример #9
0
        // GET: AdminUye/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            uye uye = db.uyes.Find(id);

            if (uye == null)
            {
                return(HttpNotFound());
            }
            ViewBag.yetkiId = new SelectList(db.yetkis, "yetkiId", "yetki1", uye.yetkiId);
            return(View(uye));
        }
Пример #10
0
        public ActionResult Login(uye Uye)
        {
            var login = db.uyes.Where(u => u.kullaniciadi == Uye.kullaniciadi).SingleOrDefault();

            if (login.kullaniciadi == Uye.kullaniciadi && login.email == Uye.email && login.sifre == Uye.sifre)
            {
                Session["UyeId"]        = login.uyeid;
                Session["KullaniciAdi"] = login.kullaniciadi;
                Session["YetkiId"]      = login.yetkiid;
                return(RedirectToAction("Index", "Home"));
            }

            else
            {
                return(View());
            }
        }
Пример #11
0
        public ActionResult Login(uye uye)
        {
            var login = db.uyes.Where(u => u.kullaniciAdi == uye.kullaniciAdi).SingleOrDefault();

            if (login.kullaniciAdi == uye.kullaniciAdi && login.email == uye.email && login.sifre == uye.sifre)
            {
                Session["uyeid"]        = login.uyeId;
                Session["kullaniciadi"] = login.kullaniciAdi;
                Session["yetkiid"]      = login.yetkiId;
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                ViewBag.Uyari = "Kullanıcı Adı, Mail ya da Şifrenizi Kontrol Ediniz!!";
                return(View());
            }
        }
Пример #12
0
 public ActionResult create(uye uye)
 {
     if (ModelState.IsValid)
     {
         if (uye != null)
         {
             uye.yetkiId = 2;
             db.uyes.Add(uye);
             db.SaveChanges();
             Session["uyeid"]        = uye.uyeId;
             Session["kullaniciadi"] = uye.kullaniciAdi;
             return(RedirectToAction("Index", "Home"));
         }
         else
         {
             ModelState.AddModelError("üye", "Bilgileri Doldurunuz");
         }
     }
     return(View(uye));
 }
Пример #13
0
 public ActionResult kaydol(uye s)
 {
     try
     {
         using (sifaeczadposuEntities context = new sifaeczadposuEntities())
         {
             uye _slide = new uye();
             _slide.ad    = s.ad;
             _slide.soyad = s.soyad;
             _slide.k_ad  = s.k_ad;
             _slide.sifre = s.sifre;
             _slide.tel   = s.tel;
             _slide.cins  = s.cins;
             context.uye.Add(_slide);
             context.SaveChanges();
             return(RedirectToAction("Slider", "Admin"));
         }
     }
     catch (Exception ex)
     {
         throw new Exception("Eklerken hata oluştu");
     }
 }