예제 #1
0
        public ActionResult JoinUs(club_member cm)
        {
            ViewBag.IsAdmin = (bool)Session["adminLoggedIn"];

            if (cm.firstName == null)
            {
                return(View());
            }
            else
            {
                if (ModelState.IsValid)
                {
                    cm.joinDate = DateTime.Now.Date;
                    cm.status   = "Pending";
                    edb.club_member.Add(cm);
                    edb.SaveChanges();

                    ViewBag.JoinSuccess = "true";
                    return(GetClubHomeView());
                }
                else
                {
                    ViewBag.JoinSuccess = null;
                    return(View(cm));
                }
            }
        }
예제 #2
0
        public ActionResult Delete(int num = 0)
        {
            club_member member = Db.club_member.Find(num);

            if (member == null)
            {
                return(HttpNotFound());
            }
            return(View(member));
        }
예제 #3
0
 public ActionResult Edit(club_member member)
 {
     if (ModelState.IsValid)
     {
         Db.Entry(member).State = EntityState.Modified;
         Db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(member));
 }
예제 #4
0
 public ActionResult Create(club_member member)
 {
     if (ModelState.IsValid)
     {
         Db.club_member.Add(member);
         Db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(member));
 }
예제 #5
0
        public ActionResult ChangeApproval(int num = 0)
        {
            string      result = "";
            club_member member = Db.club_member.Find(num);

            if (member != null)
            {
                member.IsApproval = member.IsApproval == true ? false : true;
                result            = member.IsApproval == true ? "Üye başarıyla onaylandı." : "Üyenin onayı başarıyla kaldırıldı.";
                Db.SaveChanges();
            }
            return(Content("<script type=\"text/javascript\">SuccessInfo('" + result + "');</script>"));
        }
예제 #6
0
        public ActionResult DeleteConfirmed(int num)
        {
            club_member member = Db.club_member.Find(num);

            foreach (var post in member.club_posts)
            {
                Db.club_post.Remove(post);
            }
            foreach (var comment in member.club_comments)
            {
                Db.club_postcomment.Remove(comment);
            }
            Db.club_member.Remove(member);
            Db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #7
0
        public ActionResult Login(club_member model)
        {
            string result;
            string password = FormsAuthentication.HashPasswordForStoringInConfigFile(model.Password.ToString(), "md5").ToString();
            var    member   = Db.club_member.SingleOrDefault(x => x.Email == model.Email && x.Password == password);

            if (member == null)
            {
                result = "<font color=red>Böyle bir hesap bulunamadı..</font>";
            }
            else
            {
                Session["memberinfo"] = member;
                Session["memberid"]   = member.Id;
                Session["memberrole"] = member.Role;
                result = "<font color=green>Hesabınıza giriş yapılıyor..</font><script type=\"text/javascript\">setTimeout(function () { window.location.href='" + Url.Action("Index", "Home") + "'; }, 2000);</script>";
            }
            return(Content(result));
        }