public bool CheckUser(string email, string password) { var isUser = false; ManageDataContext context = new ManageDataContext(); context.Connection.Open(); var result = context.tbl_PortalHaber_Yazars.FirstOrDefault(u => u.EPosta == email && u.Sifre == password); context.Connection.Close(); context.Dispose(); isUser = result != null; return(isUser); }
public Boolean IsEmailInSystem(string email) { var isEmail = false; ManageDataContext context = new ManageDataContext(); context.Connection.Open(); var result = context.tbl_PortalHaber_Yazars.FirstOrDefault(u => u.EPosta == email); context.Connection.Close(); context.Dispose(); isEmail = result != null; return(isEmail); }
public bool UpdateEssayToDb(EssayModel model, int id, string useremail) { var result = false; try { var context = new ManageDataContext(); context.Connection.Open(); var tblIcerik = context.tbl_PortalHaber_Iceriks.FirstOrDefault(u => u.HaberId == id); var tblIcerik2 = context.tbl_PortalHaber_Icerik2s.FirstOrDefault(u => u.HaberId == id); var user = context.tbl_PortalHaber_Yazars.FirstOrDefault(u => u.EPosta == useremail); if (tblIcerik != null) { tblIcerik.Banner_Tip = model.BannerId; tblIcerik.HaberUrl = model.Baslik.Replace('Ç', 'c').Replace('ç', 'c').Replace(' ', '-').Replace('Ö', 'o').Replace('ö', 'o').Replace('ğ', 'g').Replace('Ğ', 'g').Replace('ü', 'u').Replace('Ü', 'u').Replace('İ', 'i').Replace('Ş', 's').Replace('ş', 's').Replace('ı', 'i').Replace('.', '-').Replace('&', '-').Replace('/', '-'); tblIcerik.Haber_Resim = model.HaberResimFile.FileName; tblIcerik.KategoriId = model.KategoriId; tblIcerik.KaynakId = model.KaynakId; tblIcerik.Onay_Tarih = DateTime.Now; tblIcerik.Site_Id = model.SiteId; tblIcerik.HaberAciklama = model.Aciklama; tblIcerik.HaberBaslik = model.Baslik; if (tblIcerik2 != null) { tblIcerik2.Etiketler = model.Hastags; tblIcerik2.HaberMetni = model.EssayContent; if (user != null) { tblIcerik2.YazarId = user.YazarId; } } context.SubmitChanges(); result = true; context.Connection.Close(); context.Dispose(); } } catch (Exception) { result = false; throw; } return(result); }