public void AddRelatedLinksDetailsToDB(RelatedLinks collection) { using (SqlConnection con = new SqlConnection(connectionString)) { SqlCommand cmd = new SqlCommand("spAddRelatedLinksDetails", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter paramsellerAddress = new SqlParameter(); paramsellerAddress.ParameterName = "@linkAddress"; paramsellerAddress.Value = collection.linkAddress; //cmd.Parameters.Add(paramsellerAddress); cmd.Parameters.AddWithValue("@linkAddress", collection.linkAddress); SqlParameter paramsellerExpiryDate = new SqlParameter(); paramsellerExpiryDate.ParameterName = "@linkDescription"; paramsellerExpiryDate.Value = collection.linkDescription; //cmd.Parameters.Add(paramsellerExpiryDate); cmd.Parameters.AddWithValue("@linkDescription", collection.linkDescription); SqlParameter paramsellerPhone = new SqlParameter(); paramsellerPhone.ParameterName = "@linkName"; paramsellerPhone.Value = collection.linkName; //cmd.Parameters.Add(paramsellerPhone); cmd.Parameters.AddWithValue("@linkName", collection.linkName); con.Open(); cmd.ExecuteNonQuery(); } }
public ActionResult Create(CTBusinessLayer.RelatedLinks collection) { if (ModelState.IsValid) { dbset.AddRelatedLinksDetailsToDB(collection); return(RedirectToAction("Index")); } return(View()); }
// // GET: /CrystalManagerRelatedLinks/Edit/5 public ActionResult Edit(int id) { CTBusinessLayer.RelatedLinks ctitem = dbset.RelatedLinked.Single(emp => emp.linkId == id); if (ctitem == null) { return(HttpNotFound()); } return(View(ctitem)); }
public ActionResult Edit(CTBusinessLayer.RelatedLinks collection) { if (ModelState.IsValid) { var num = collection.linkId; dbset.SaveChangesRelatedLinksDetailsToDB(collection); return(RedirectToAction("Index")); } return(View(collection)); }