Beispiel #1
0
        public void ChangeType(int id)
        {
            tbmember user = db.tbmembers.Find(id);

            if (user.accounttype == "A")
            {
                user.accounttype = "N";
            }
            else
            {
                user.accounttype = "A";
            }
            db.SaveChanges();
            Response.Redirect("/Admin/User");
        }
Beispiel #2
0
        public void AddOrEditPoetAsync(int poetid, string bio, string namesur)
        {
            string returnurl = "/Admin/Poet/Index/";

            try
            {
                tbpoet poet;
                if (poetid == 0)
                {
                    poet = new tbpoet()
                    {
                        biography      = bio,
                        nameandsurname = namesur,
                    };
                    db.tbpoets.Add(poet);
                    db.SaveChanges();
                }
                else
                {
                    poet                = db.tbpoets.Find(poetid);
                    poet.biography      = bio;
                    poet.nameandsurname = namesur;
                    db.SaveChanges();
                }
                returnurl += $"/{poet.poetID}/";
                Response.Redirect(returnurl);
            }
            catch (Exception ex)
            {
                returnurl += $"/?error=ex";
                Response.Redirect(returnurl);
            }
        }
Beispiel #3
0
        public void AddCategoryAsync(int catid, string name, string desc)
        {
            ExitIsNotAdmin();
            string returnUrl = "/Admin/Category/Index/";

            try
            {
                tbcategory cat = null;
                if (catid != 0)
                {
                    cat             = db.tbcategories.FirstOrDefault(x => x.categoryID == catid);
                    cat.name        = name;
                    cat.description = desc;
                    db.SaveChanges();
                }
                else
                {
                    cat = new tbcategory()
                    {
                        name        = name,
                        description = desc
                    };
                    db.tbcategories.Add(cat);
                    db.SaveChanges();
                }

                returnUrl += cat.categoryID.ToString() + "/";


                Response.Redirect(returnUrl);
            }
            catch (Exception ex)
            {
                Response.Redirect(returnUrl + "?error=ex");
            }
        }
Beispiel #4
0
        public JsonResult InstallAsync(string mail, string nick, string pass, string pass2)
        {
            JsonProcess jp = null;

            try
            {
                if (pass.Length < 4 || pass.Length > 16)
                {
                    jp = new JsonProcess(false, "Şifre En Az 4, En Fazla 16 Karakter Olabilir.");
                    return(Json(jp));
                }

                if (pass != pass2)
                {
                    jp = new JsonProcess(false, "Şifreler Birbiriyle Uyuşmuyor.");
                    return(Json(jp));
                }
                if (!InOp.MailIsValid(mail))
                {
                    jp = new JsonProcess(false, "Bu Mail Adresi Geçersiz.");
                    return(Json(jp));
                }


                tbmember member = new tbmember
                {
                    accounttype = "A",
                    mail        = mail,
                    nick        = nick,
                    password    = InOp.CreateMD5(pass),
                };
                db.tbmembers.Add(member);
                db.SaveChanges();

                Session["member"]   = member;
                Session["memberid"] = member.memberID;
                jp = new JsonProcess(true, member.memberID.ToString());
                return(Json(jp));
            }
            catch (DbEntityValidationException ex)
            {
                jp = new JsonProcess(false, "Hata Oluştu. " + ex.Message);
                return(Json(jp));
            }
        }
Beispiel #5
0
        public JsonResult CreateAsync(string nick, string mail, string namesur, string pass, string pass2, string sec, string dtS, string gender)
        {
            JsonProcess jp = null;
            DateTime    dt = Convert.ToDateTime(dtS);

            try
            {
                if (pass.Length < 4 || pass.Length > 16)
                {
                    jp = new JsonProcess(false, "Şifre En Az 4, En Fazla 16 Karakter Olabilir.");
                    return(Json(jp));
                }
                if (Session["resim"] == null)
                {
                    jp = new JsonProcess(false, "Bir Sorun Oluştu.");
                    return(Json(jp));
                }
                if (Session["resim"].ToString() != sec)
                {
                    jp = new JsonProcess(false, "Güvenlik Kodu Hatalı");
                    return(Json(jp));
                }
                if (pass != pass2)
                {
                    jp = new JsonProcess(false, "Şifreler Birbiriyle Uyuşmuyor.");
                    return(Json(jp));
                }
                if (!InOp.MailIsValid(mail))
                {
                    jp = new JsonProcess(false, "Bu Mail Adresi Geçersiz.");
                    return(Json(jp));
                }
                if (db.tbmembers.FirstOrDefault(x => x.mail == mail) != null)
                {
                    jp = new JsonProcess(false, "Bu Mail Adresi Kullanılıyor.");
                    return(Json(jp));
                }
                if (db.tbmembers.FirstOrDefault(x => x.nick == nick) != null)
                {
                    jp = new JsonProcess(false, "Bu Kullanıcı Adı Kullanılıyor.");
                    return(Json(jp));
                }

                tbmember member = new tbmember()
                {
                    accounttype    = "N",
                    birthdate      = dt,
                    gender         = gender,
                    mail           = mail,
                    nameandsurname = namesur,
                    nick           = nick,
                    password       = InOp.CreateMD5(pass),
                };
                db.tbmembers.Add(member);
                db.SaveChanges();

                Session["member"]   = member;
                Session["memberid"] = member.memberID;
                jp = new JsonProcess(true, member.memberID.ToString());
                return(Json(jp));
            }
            catch (Exception ex)
            {
                jp = new JsonProcess(false, "Hata Oluştu. " + ex.Message);
                return(Json(jp));
            }
        }