public ActionResult RemoveCustomer(int id) { Addcustomer ac = db.Addcustomers.Where(i => i.Id == id).FirstOrDefault(); db.Addcustomers.Remove(ac); db.SaveChanges(); return(RedirectToAction("Customerlist", "Home")); }
public ActionResult UpdateCustomer(AddcustomerModel model) { Addcustomer ac = db.Addcustomers.Where(i => i.Id == model.id).FirstOrDefault(); ac.Id = model.id; ac.Customerid = model.cityid; ac.Name = model.Name; ac.Dob = model.Dob; ac.countryid = model.countryid; ac.stateid = model.stateid; ac.cityid = model.cityid; ac.Address = model.Address; ac.Email = model.Email; ac.Mobile = model.Mobile; ac.Survey = model.wouldyouliketoparticipateinSurvey; db.SaveChanges(); return(RedirectToAction("Customerlist", "Home")); }
public ActionResult Addcustomer(AddcustomerModel model) { Addcustomer ac = new Addcustomer(); ac.Id = model.id; ac.Customerid = model.cityid; ac.Name = model.Name; ac.Dob = model.Dob; ac.countryid = model.countryid; ac.stateid = model.stateid; ac.cityid = model.cityid; ac.Address = model.Address; ac.Email = model.Email; ac.Mobile = model.Mobile; ac.Survey = model.wouldyouliketoparticipateinSurvey; db.Addcustomers.Add(ac); db.SaveChanges(); TempData["Success"] = "Customer data added successfully."; return(RedirectToAction("Addcustomer", "Home")); }
private void Addbtn_Click(object sender, EventArgs e) { Addcustomer add = new Addcustomer(); add.ShowDialog(); }