public ActionResult DeleteConfirmed(int id) { PCondition pCondition = db.PaymentCondition.Find(id); db.PaymentCondition.Remove(pCondition); db.SaveChanges(); return(RedirectToAction("Index")); }
private void login(object sender, EventArgs e) { SqlConnection con = new SqlConnection(@"Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=Jaynets;Integrated Security=True"); // making connection SqlDataAdapter sda = new SqlDataAdapter("SELECT COUNT(*) FROM Login WHERE username='******' AND password='******'", con); /* in above line the program is selecting the whole data from table and the matching it with the user name and password provided by user. */ DataTable dt = new DataTable(); //this is creating a virtual table sda.Fill(dt); if (dt.Rows[0][0].ToString() == "1") { PNmae.Show(); PNmaef.Show(); PBrand.Show(); PBrandf.Show(); PType.Show(); PTypef.Show(); PManufacture.Show(); PManufacturef.Show(); PWarrant.Show(); PWarrantf.Show(); PCondition.Show(); PConditionF.Show(); Back.Show(); SqlCommand cmd = new SqlCommand("sp_insert", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Name", PNmaef.Text); cmd.Parameters.AddWithValue("@eBrand", PBrandf.Text); cmd.Parameters.AddWithValue("@Type", PTypef.Text); cmd.Parameters.AddWithValue("@Manufacture", PManufacturef.Text); con.Open(); con.Close(); greeting.Hide(); prompt.Hide(); dpt.Hide(); Deptf.Hide(); Passf.Hide(); Nameef.Hide(); Uname.Hide(); pwd.Hide(); Login.Hide(); linkLabel1.Hide(); } else { Nameef.Clear(); Passf.Clear(); Deptf.Clear(); err.Show(); } }
public ActionResult Edit([Bind(Include = "IdPaymentCondition,ConditionName")] PCondition pCondition) { if (ModelState.IsValid) { db.Entry(pCondition).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(pCondition)); }
public ActionResult Create([Bind(Include = "IdPaymentCondition,ConditionName")] PCondition pCondition) { if (ModelState.IsValid) { db.PaymentCondition.Add(pCondition); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(pCondition)); }
// GET: PConditions/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PCondition pCondition = db.PaymentCondition.Find(id); if (pCondition == null) { return(HttpNotFound()); } return(View(pCondition)); }