public void Delete(int ID) { //to delete the entries from table using (DonutsShopEntities2 context = new DonutsShopEntities2()) { main obj = context.mains.First(x => x.ID == ID); context.mains.Remove(obj); context.SaveChanges(); } }
public void Update(int ID, string Name, string order, string email) { //to update the once entered values in the table, it will update in both database and the page using (var db = new DonutsShopEntities2()) { var Mainobj = db.mains.SingleOrDefault(b => b.ID == ID); if (Mainobj != null) { Mainobj.Name = Name; Mainobj.oder = order; Mainobj.email = email; db.SaveChanges(); } } }
protected void loginDonut_Click(object sender, EventArgs e) { DonutsShopEntities2 db = new DonutsShopEntities2(); //selects username from the user table and pass it to the query string query = (from c in db.UserTables where c.Username == Donutlogin.Text && c.Password == Donutpass.Text select c.Username).FirstOrDefault(); if (query != null) { Response.Redirect("Donut.aspx");//if the query is verified from the user table } else { Response.Write("Wrong Details"); //if the query is invalid which means the details is not in the user table } }