예제 #1
0
 public bool EditYorum(Yorum yorum)
 {
     using (var databaseContext = new HaberContext())
     {
         databaseContext.Entry(yorum).State = EntityState.Modified;
         return(databaseContext.SaveChanges() > 0);
     }
 }
 public bool EditKategori(Kategori kategori)
 {
     using (var databaseContext = new HaberContext())
     {
         databaseContext.Entry(kategori).State = EntityState.Modified;
         return(databaseContext.SaveChanges() > 0);
     }
 }
예제 #3
0
 public bool EditHaber(Entities.EF.Haber haber)
 {
     using (var databaseContext = new HaberContext())
     {
         databaseContext.Entry(haber).State = EntityState.Modified;
         return(databaseContext.SaveChanges() > 0);
     }
 }
예제 #4
0
 public Entities.EF.Haber GetHaber(int id)
 {
     Entities.EF.Haber haber;
     using (var databaseContext = new HaberContext())
     {
         haber = databaseContext.Haber.FirstOrDefault(i => i.Id.Equals(id));
     }
     return(haber);
 }
        public Kategori GetKategori(int id)
        {
            Kategori kategori;

            using (var databaseContext = new HaberContext())
            {
                kategori = databaseContext.Kategori.FirstOrDefault(i => i.Id.Equals(id));
            }
            return(kategori);
        }
예제 #6
0
        public Yorum GetYorum(int id)
        {
            Yorum yorum;

            using (var databaseContext = new HaberContext())
            {
                yorum = databaseContext.Yorum.FirstOrDefault(i => i.Id.Equals(id));
            }
            return(yorum);
        }
예제 #7
0
        public List <Entities.EF.Haber> GetAllHaber()
        {
            List <Entities.EF.Haber> haber;

            using (HaberContext databaseContext = new HaberContext())
            {
                haber = databaseContext.Haber.Include("Kategori").ToList();
            }
            return(haber);
        }
예제 #8
0
        public Kullanici GetKullanici(int id)
        {
            Kullanici kullanici;

            using (var databaseContext = new HaberContext())
            {
                kullanici = databaseContext.Kullanici.FirstOrDefault(i => i.Id.Equals(id));
            }
            return(kullanici);
        }
예제 #9
0
        public List <Galeri> GetAllGaleri()
        {
            List <Galeri> galeri;

            using (var database = new HaberContext())
            {
                galeri = database.Galeri.ToList();
            }
            return(galeri);
        }
예제 #10
0
        public List <Kategori> GetAllKategori()
        {
            List <Kategori> kategori;

            using (var database = new HaberContext())
            {
                kategori = database.Kategori.ToList();
            }
            return(kategori);
        }
예제 #11
0
        public List <Yorum> GetAllYorum()
        {
            List <Yorum> yorum;

            using (var database = new HaberContext())
            {
                yorum = database.Yorum.ToList();
            }
            return(yorum);
        }
예제 #12
0
        public Galeri GetGaleri(int id)
        {
            Galeri galeri;

            using (var databaseContext = new HaberContext())
            {
                galeri = databaseContext.Galeri.FirstOrDefault(i => i.Id.Equals(id));
            }
            return(galeri);
        }
예제 #13
0
        public List <Kullanici> GetAllKullanici()
        {
            List <Kullanici> kullanici;

            using (
                var database = new HaberContext())
            {
                kullanici = database.Kullanici.ToList();
            }
            return(kullanici);
        }
예제 #14
0
파일: YazarHelper.cs 프로젝트: dgncn/Haber
 public YazarHelper(HaberContext tContext)
 {
     context = tContext;
 }
예제 #15
0
파일: Global.asax.cs 프로젝트: dgncn/Haber
 public static int kullaniciSayisi()
 {
     HaberContext context = new HaberContext();
     int kullaniciSayisi = context.Users.Count();
     return kullaniciSayisi;
 }
예제 #16
0
파일: Global.asax.cs 프로젝트: dgncn/Haber
        public static HaberUser kullaniciBilgiAlAdIle(string userAdi)
        {
            HaberContext context = new HaberContext();
            RoleStore<HaberRole> roleStore = new RoleStore<HaberRole>(context);
            RoleManager<HaberRole> roleManager = new RoleManager<HaberRole>(roleStore);

            UserStore<HaberUser> userStore = new UserStore<HaberUser>(context);
            UserManager<HaberUser> userManager = new UserManager<HaberUser>(userStore);
            var kullanici = userManager.FindByName(userAdi);
            if (kullanici != null)
            {
                return kullanici;
            }
            else
            {
                return new HaberUser { };
            }
        }
예제 #17
0
파일: EtiketHelper.cs 프로젝트: dgncn/Haber
 public EtiketHelper()
 {
     context = new HaberContext();
 }
예제 #18
0
 public HakkindaHelper()
 {
     context = new HaberContext();
 }
예제 #19
0
 public HaberClHelper(HaberContext tContext)
 {
     context = tContext;
 }
예제 #20
0
파일: YorumHelper.cs 프로젝트: dgncn/Haber
 public YorumHelper(HaberContext tContext)
 {
     context = tContext;
 }
예제 #21
0
파일: YorumHelper.cs 프로젝트: dgncn/Haber
 public YorumHelper()
 {
     context = new HaberContext();
 }
예제 #22
0
파일: Global.asax.cs 프로젝트: dgncn/Haber
 public static int kategoriSayisi()
 {
     HaberContext context = new HaberContext();
     int kategoriAdedi = context.Kategoriler.Count();
     return kategoriAdedi;
 }
예제 #23
0
파일: Global.asax.cs 프로젝트: dgncn/Haber
 public static int yazarSayisi()
 {
     HaberContext context = new HaberContext();
     int yazarAdedi = context.Yazarlar.Count();
     return yazarAdedi;
 }
예제 #24
0
파일: Global.asax.cs 프로젝트: dgncn/Haber
 public static int haberSayisi()
 {
     HaberContext context = new HaberContext();
     int haberAdedi = context.Haberler.Count();
     return haberAdedi;
 }
예제 #25
0
파일: Global.asax.cs 프로젝트: dgncn/Haber
        public static string rolBilgisiAl(string rolAdi)
        {
            HaberContext context = new HaberContext();
            RoleStore<HaberRole> roleStore = new RoleStore<HaberRole>(context);
            RoleManager<HaberRole> roleManager = new RoleManager<HaberRole>(roleStore);

            UserStore<HaberUser> userStore = new UserStore<HaberUser>(context);
            UserManager<HaberUser> userManager = new UserManager<HaberUser>(userStore);
            var role = roleManager.FindByName(rolAdi);
            if (role != null)
            {
                return role.Id;
            }
            else
            {
                return "";
            }
        }
예제 #26
0
 public HaberClHelper()
 {
     context = new HaberContext();
 }
 public KullaniciRepository()
 {
     _context = new HaberContext();
 }
예제 #28
0
 public List<HaberCl> TumHaberleriListele()
 {
     HaberContext context2 = new HaberContext();
     var list = context2.Haberler.ToList();
     return list;
 }
예제 #29
0
 public KategoriHelper()
 {
     context = new HaberContext();
 }
예제 #30
0
 public HakkindaHelper(HaberContext tContext)
 {
     context = tContext;
 }
예제 #31
0
 public KategoriRepository()
 {
     _context = new HaberContext();
 }
예제 #32
0
파일: EtiketHelper.cs 프로젝트: dgncn/Haber
 public EtiketHelper(HaberContext tContext)
 {
     context = tContext;
 }
예제 #33
0
파일: ResimHelper.cs 프로젝트: dgncn/Haber
 public ResimHelper(HaberContext tContext)
 {
     context = tContext;
 }
예제 #34
0
파일: Global.asax.cs 프로젝트: dgncn/Haber
 public static int yorumSayisi()
 {
     HaberContext context = new HaberContext();
     int yorumSayisi = context.Yorumlar.Count();
     return yorumSayisi;
 }
예제 #35
0
파일: Global.asax.cs 프로젝트: dgncn/Haber
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            RouteConfig.RegisterRoutes(RouteTable.Routes);


            HaberContext context = new HaberContext();
            RoleStore<HaberRole> roleStore = new RoleStore<HaberRole>(context);
            RoleManager<HaberRole> roleManager = new RoleManager<HaberRole>(roleStore);

            UserStore<HaberUser> userStore = new UserStore<HaberUser>(context);
            UserManager<HaberUser> userManager = new UserManager<HaberUser>(userStore);

            if (!roleManager.RoleExists("SuperAdmin"))
            {
                HaberRole suRole = new HaberRole("SuperAdmin", "Sistem Ana Yöneticisi");
                roleManager.Create(suRole);

            }
            var user = userManager.FindByName("SuperUser");
            if (user == null)
            {
                HaberUser huser = new HaberUser
                {
                    Name = "Super",
                    SurName = "User",
                    UserName = "******",
                    EklenmeTarihi = DateTime.Now
                };

                IdentityResult ir = userManager.Create(huser, "123456");
                if (ir.Succeeded)
                {
                    userManager.AddToRole(huser.Id, "SuperAdmin");
                }


            }
            else
            {
                if (!userManager.IsInRole(user.Id, "SuperAdmin"))
                {
                    userManager.AddToRole(user.Id, "SuperAdmin");
                }
            }

            if (!roleManager.RoleExists("Admin"))
            {
                HaberRole adminRole = new HaberRole("Admin", "Yönetici");
                roleManager.Create(adminRole);
            }

            if (!roleManager.RoleExists("User"))
            {
                HaberRole userRole = new HaberRole("User", "Okuyucu, yorum yazan");
                roleManager.Create(userRole);
            }
            if (!roleManager.RoleExists("News Writer"))
            {
                HaberRole newsRole = new HaberRole("News Writer", "Haber yazarı");
                roleManager.Create(newsRole);
            }
        }
예제 #36
0
파일: ResimHelper.cs 프로젝트: dgncn/Haber
 public ResimHelper()
 {
     context = new HaberContext();
 }
예제 #37
0
파일: YazarHelper.cs 프로젝트: dgncn/Haber
 public YazarHelper()
 {
    context = new HaberContext();
 }
예제 #38
0
 public KategoriHelper(HaberContext tContext)
 {
     context = tContext;
 }
예제 #39
0
파일: Global.asax.cs 프로젝트: dgncn/Haber
 public static int etiketSayisi()
 {
     HaberContext context = new HaberContext();
     int etiketSayisi = context.Etiketler.Count();
     return etiketSayisi;
 }
예제 #40
0
 public IletisimHelper()
 {
     context = new HaberContext();
 }
예제 #41
0
 public IletisimHelper(HaberContext tContext)
 {
     context = tContext;
 }
예제 #42
0
 public ResimRepository()
 {
     _context = new HaberContext();
 }
예제 #43
0
 public HaberRepository()
 {
     _context = new HaberContext();
 }