Beispiel #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (Request.QueryString["Article"] != null)
            {
                current.Name_of_recepie = Name.Text;
                current.Recepie         = Rec.Text;

                a.recepies.Attach(current);
                var entry = a.Entry(current);
                entry.Property(y => y.Recepie).IsModified         = true;
                entry.Property(y => y.Name_of_recepie).IsModified = true;
            }
            else
            {
                a       = new all_dataEntities();
                current = new recepies();
                current.Name_of_recepie = Name.Text;
                current.Recepie         = Rec.Text;
                current.Author          = Session["Nickname"].ToString();
                current.ID = a.recepies.Count();
                a.recepies.Add(current);
            }
            a.SaveChanges();
            Response.Redirect("Default.aspx");
        }
Beispiel #2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            users new_one = new users();

            new_one.Nickname = TextBox1.Text;
            new_one.Password = TextBox2.Text;
            all_dataEntities temp = new all_dataEntities();

            if (temp.users.Find(TextBox1.Text, @"^(?!\s*$).+") == null)
            {
                temp.users.Add(new_one);
            }
            else
            {
                alert.Text = "This nickname already used.";
            }
            temp.SaveChanges();

            HttpCookie myCookie = new HttpCookie("User");

            myCookie["Nickname"] = new_one.Nickname;
            myCookie["Pass"]     = new_one.Password;
            myCookie.Expires     = DateTime.Now.AddDays(1d);
            Response.Cookies.Add(myCookie);
            Session["Nickname"] = TextBox1.Text;
            Response.Redirect("/Default.aspx");
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            users new_one = new users();
            new_one.Nickname = TextBox1.Text;
            new_one.Password = TextBox2.Text;
            all_dataEntities temp = new all_dataEntities();

            if (temp.users.Find(TextBox1.Text, @"^(?!\s*$).+") == null)
            {
                temp.users.Add(new_one);
            }
            else
                alert.Text = "This nickname already used.";
            temp.SaveChanges();

            HttpCookie myCookie = new HttpCookie("User");
            myCookie["Nickname"] = new_one.Nickname;
            myCookie["Pass"] = new_one.Password;
            myCookie.Expires = DateTime.Now.AddDays(1d);
            Response.Cookies.Add(myCookie);
            Session["Nickname"] = TextBox1.Text;
            Response.Redirect("/Default.aspx");
        }