Esempio n. 1
0
        public ActionResult YazarOl(Kullanici k1, string rdBay, string rdBayan)
        {
            if (!string.IsNullOrEmpty(rdBay))
            {
                k1.Cinsiyet = true;
            }
            if (!string.IsNullOrEmpty(rdBayan))
            {
                k1.Cinsiyet = false;
            }

            k1.Yazar       = true;
            k1.Onaylandı   = false;
            k1.Aktif       = true;
            k1.KayitTarihi = DateTime.Now;
            context.Kullanici.Add(k1);
            context.SaveChanges();

            Rol          yazar = context.Rol.FirstOrDefault(x => x.RolAdi == "Yazar");
            KullaniciRol kr    = new KullaniciRol();

            kr.KullaniciID = k1.KullaniciId;
            kr.RolID       = k1.RolId;
            context.KullaniciRol.Add(kr);
            context.SaveChanges();
            return(RedirectToAction("Index", "Home"));
        }
        public ActionResult UyeOl(Kullanici kl, string rdBay, string rdBayan)
        {
            if (!string.IsNullOrEmpty(rdBay))
            {
                kl.Cinsiyet = true;
            }
            if (!string.IsNullOrEmpty(rdBayan))
            {
                kl.Cinsiyet = false;
            }

            kl.Yazar       = false;
            kl.Onaylandi   = true;
            kl.Aktif       = true;
            kl.KayitTarihi = DateTime.Now;
            context.Kullanicis.Add(kl);
            context.SaveChanges();

            Rol yazar = context.Rols.FirstOrDefault(x => x.RolAdi == "Üye");

            KullaniciRol kr = new KullaniciRol();

            kr.RolID       = yazar.RolID;
            kr.KullaniciID = kl.KullaniciId;
            context.KullaniciRols.Add(kr);
            context.SaveChanges();

            return(RedirectToAction("GirisYap"));
        }
Esempio n. 3
0
        public ActionResult YazarOl(Kullanicilar kl, string rdBay, string rdBayan)
        {
            if (!string.IsNullOrEmpty(rdBay))
            {
                kl.Cinsiyet = true;
            }
            if (!string.IsNullOrEmpty(rdBayan))
            {
                kl.Cinsiyet = false;
            }
            kl.Yazar       = true;
            kl.Onaylandi   = false;
            kl.Aktif       = true;
            kl.KayitTarihi = DateTime.Now;
            db.Kullanicilar.Add(kl);
            db.SaveChanges();

            Rol          yazar = db.Rol.FirstOrDefault(x => x.RolAdi == "Yazar");
            KullaniciRol kr    = new KullaniciRol();

            kr.RolID       = yazar.RolId;
            kr.KullaniciID = kl.KullaniciId;
            db.KullaniciRol.Add(kr);
            db.SaveChanges();
            return(RedirectToAction("Index", "Home"));
        }
Esempio n. 4
0
        public ActionResult YazarOl(Kullanici k, string radio)
        {
            if (radio == "1")
            {
                k.Cinsiyet = true;
            }
            else
            {
                k.Cinsiyet = false;
            }
            k.Yazar       = true;
            k.Onaylandi   = false;
            k.Aktif       = true;
            k.KayitTarihi = DateTime.Now;
            db.Kullanicis.Add(k);
            db.SaveChanges();

            Rol          yazar = db.Rols.FirstOrDefault(x => x.RolAdi == "Yazar");
            KullaniciRol kr    = new KullaniciRol();

            kr.RolID       = yazar.RolId;
            kr.KullaniciID = k.KullaniciId;
            db.KullaniciRols.Add(kr);
            db.SaveChanges();
            return(RedirectToAction("Index", "Home"));
        }
        public ActionResult YazarOl(Kullanici kl)
        {
            if (context.Kullanicis.Any(x => x.KullaniciAdi == kl.KullaniciAdi || x.MailAdres == kl.MailAdres))
            {
                return(View());
            }
            kl.Yazar     = true;
            kl.Onaylandi = false;
            kl.Aktif     = true;
            if (kl.DogumTarihi != null)
            {
                kl.DogumTarihi = kl.DogumTarihi.Value.Date;
            }
            kl.KayitTarihi = DateTime.Now;
            context.Kullanicis.Add(kl);
            context.SaveChanges();
            Rol          yazar = context.Rols.FirstOrDefault(x => x.RolAdi == "Yazar");
            KullaniciRol kr    = new KullaniciRol();

            kr.RolID       = yazar.RolId;
            kr.KullaniciID = kl.KullaniciId;
            context.KullaniciRols.Add(kr);
            context.SaveChanges();

            return(RedirectToAction("GirisYap"));
        }
Esempio n. 6
0
        // GET: Kullanici/RolAta/5
        public ActionResult RolAta(int id)
        {
            KullaniciRol krol = new KullaniciRol();

            krol.KullaniciId = id;
            ViewBag.Rol      = new SelectList(db.Rol, "Id", "RolAd");
            return(View(krol));
        }
Esempio n. 7
0
        public ActionResult RolAta(KullaniciRol model)
        {
            if (ModelState.IsValid)
            {
                db.KullaniciRol.Add(model);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.Rol = new SelectList(db.Rol, "Id", "RolAd");

            return(View(model));
        }
Esempio n. 8
0
        public async Task <ActionResult> RolKullaniciEsle(int KullaniciId, int Rol1)
        {
            KullaniciRol data = new KullaniciRol()
            {
                KullaniciId = KullaniciId,
                RolId       = Rol1,
            };

            _client.BaseAddress = new Uri("http://localhost:55502/api/Kullanici/KullaniciRolEsle");

            StringContent       content  = new StringContent(JsonConvert.SerializeObject(data), System.Text.Encoding.UTF8, "application/json");
            HttpResponseMessage response = _client.PostAsync("http://localhost:55502/api/Kullanici/KullaniciRolEsle", content).Result;

            if (response.IsSuccessStatusCode)
            {
                return(RedirectToAction("Index", "Admin"));
            }
            return(RedirectToAction("Index", "Admin"));
        }
Esempio n. 9
0
        public ActionResult OnayVer(int id)
        {
            Kullanici kl = ctx.Kullanicis.FirstOrDefault(x => x.KullaniciId == id);

            kl.Onaylandi = true;

            ctx.SaveChanges();

            Rol yazar = ctx.Rols.FirstOrDefault(x => x.RolAdi == "Yazar");

            KullaniciRol kr = new KullaniciRol();

            kr.RolID       = yazar.RolId;
            kr.KullaniciID = kl.KullaniciId;

            ctx.KullaniciRols.Add(kr);
            ctx.SaveChanges();

            return(RedirectToAction("YazarOnaylari"));
        }
Esempio n. 10
0
        public ActionResult Index(FormCollection form)
        {
            melihcelenkmainEntities db = new melihcelenkmainEntities();
            //AnasayfaDTO obj = new AnasayfaDTO();
            Kullanicilar model = new Kullanicilar();
            KullaniciRol rol   = new KullaniciRol();

            //obj.kullanicirol = db.KullaniciRol.ToList();

            rol.KullaniciID         = (db.Kullanicilar.ToList().Last().KullaniciID) + 1;
            rol.RolID               = 2;
            model.AdSoyad           = form["AdSoyad"];
            model.KullaniciAdi      = form["KullaniciAdi"];
            model.Parola            = form["Parola"];
            model.OlusturulmaTarihi = DateTime.Now;

            db.Kullanicilar.Add(model);
            db.SaveChanges();
            db.KullaniciRol.Add(rol);
            db.SaveChanges();
            return(View());
        }
Esempio n. 11
0
        public ActionResult Ekle(Kullanici klnc, HttpPostedFileBase resim, KullaniciRol roller, Rol asılrol)
        {
            Image  img       = Image.FromStream(resim.InputStream);
            Bitmap kckResim  = new Bitmap(img, Settings.ResimKucukBoyut);
            Bitmap ortaResim = new Bitmap(img, Settings.ResimOrtaBoyut);
            Bitmap bykResim  = new Bitmap(img, Settings.ResimBuyukBoyut);

            kckResim.Save(Server.MapPath("/Content/MakaleResim/KucukBoyut/" + resim.FileName));
            ortaResim.Save(Server.MapPath("/Content/MakaleResim/OrtaBoyut/" + resim.FileName));
            bykResim.Save(Server.MapPath("/Content/MakaleResim/BuyukBoyut/" + resim.FileName));

            Resim rsm = new Resim();

            rsm.BuyukBoyut = "/Content/MakaleResim/BuyukBoyut/" + resim.FileName;
            rsm.OrtaBoyut  = "/Content/MakaleResim/OrtaBoyut/" + resim.FileName;
            rsm.KucukBoyut = "/Content/MakaleResim/KucukBoyut/" + resim.FileName;


            db.Resim.Add(rsm);
            db.SaveChanges();


            klnc.ResimID = rsm.ResimId;

            klnc.KullaniciId = roller.KullaniciID;
            asılrol.RollID   = roller.RolID;



            klnc.KayitTarihi = DateTime.Now;

            db.Kullanici.Add(klnc);
            db.KullaniciRol.Add(roller);
            db.Rol.Add(asılrol);

            db.SaveChanges();
            return(RedirectToAction("Index", "PanelUyeler"));
        }
Esempio n. 12
0
 public bool Update(KullaniciRol entity)
 {
     return(_kullaniciRolDAL.Update(entity) > 0);
 }
Esempio n. 13
0
        public bool Delete(int entityID)
        {
            KullaniciRol deleted = _kullaniciRolDAL.Get(a => a.RolId == entityID);

            return(_kullaniciRolDAL.Delete(deleted) > 0);
        }
Esempio n. 14
0
 public bool Add(KullaniciRol entity)
 {//İşlem başarılı mı değil mi?
     return(_kullaniciRolDAL.Add(entity) > 0);
 }
 public ActionResult RolAta(KullaniciRol rl)
 {
     context.KullaniciRols.Add(rl);
     context.SaveChanges();
     return(RedirectToAction("KullaniciDuzenle"));
 }
Esempio n. 16
0
 public bool Add(KullaniciRol entity)
 {
     return(_kullaniciRolDAL.Add(entity) > 0);
 }