Esempio n. 1
0
 protected void Add_OnClick(object sender, EventArgs e)
 {
     using (moyEntities db = new moyEntities())
     {
         Willdo willdo = new Willdo();
         willdo.UserId  = Session["Id"].GetHashCode();
         willdo.Willdo1 = txtwilldo.Text;
         db.Willdoes.Add(willdo);
         db.SaveChanges();
     }
     txtwilldo.Text = "";
     Willdo_List();
     Response.Redirect("list.aspx");
 }
Esempio n. 2
0
 protected void PassDoingList(object sender, EventArgs e)
 {
     using (moyEntities db = new moyEntities()) {
         int   userid = Convert.ToInt32(Session["Id"]);
         Doing doing  = new Doing();
         doing.Doing1 = WilldoList.SelectedItem.Text;
         doing.UserId = Session["Id"].GetHashCode();
         db.Doings.Add(doing);
         db.SaveChanges();
         Willdo willdo = new Willdo();
         var    remove = db.Willdoes.Where(a => a.UserId == userid && a.Willdo1 == WilldoList.SelectedItem.Text).FirstOrDefault();
         db.Willdoes.Remove(remove);
         db.SaveChanges();
     }
     Willdo_List();
     Doing_List();
     Response.Redirect("list.aspx");
 }