コード例 #1
0
ファイル: Repository.cs プロジェクト: serkankarisan/NeYapsak
        public bool Add(T entity)
        {
            bool Sonuc = false;

            try
            {
                _dbSet.Add(entity);
                Sonuc = Convert.ToBoolean(_neYapsakContext.SaveChanges());
            }
            catch (Exception ex)
            {
                string hata = ex.Message;
                //throw new Exception("Kayıt yapılamadı!");
            }
            return(Sonuc);
        }
コード例 #2
0
        public ActionResult ConfirmEmail(string userId)
        {
            if (userId == null)
            {
                return(View("Error"));
            }
            var             usermanager = IdentityTools.NewUserManager();
            ApplicationUser user        = new ApplicationUser();
            NeYapsakContext ent         = new NeYapsakContext();

            user = ent.Users.Where(u => u.Id == userId).FirstOrDefault();
            if (user != null)
            {
                user.EmailConfirmed = true;
                ent.SaveChanges();
            }
            else
            {
                return(View("Error"));
            }
            return(View("ConfirmEmail"));
        }
コード例 #3
0
        public async Task <ActionResult> MesajGonder(string AliciId, string GondericiId, string Mesaj)
        {
            var        usermanager = IdentityTools.NewUserManager();
            var        Alici       = usermanager.FindById(AliciId);
            var        Gonderici   = usermanager.FindById(GondericiId);
            Gorusmeler Gorusme     = new Gorusmeler();

            Gorusme.AliciId     = AliciId;
            Gorusme.GondericiId = GondericiId;
            Gorusme.Mesaj       = Mesaj;
            ent.Gorusmeler.Add(Gorusme);
            await MesajMailiGonder(Gonderici, Alici, Mesaj).ConfigureAwait(false);

            if (Convert.ToBoolean(ent.SaveChanges()))
            {
                MsgHistViewModel Guncellet = new MsgHistViewModel();
                Guncellet.AliciId     = AliciId;
                Guncellet.GondericiId = GondericiId;
                return(PartialView("SohbetGecmisi", Guncellet));
            }
            return(PartialView("Error"));
        }