public ActionResult Create(FormCollection F) { Response.Write("The Element Has been Created"); Element E = new Element(); E.Name = F[0].ToString(); EDAL.addElement(E); List<Element> elements = EDAL.elements.ToList(); return View("Index", elements); }
public void addElement(Element E) { using (SqlConnection con = new SqlConnection(CS)) { SqlCommand cmd = new SqlCommand("addElement", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter PName = new SqlParameter(); PName.ParameterName = "@Name"; PName.Value = E.Name; cmd.Parameters.Add(PName); con.Open(); cmd.ExecuteNonQuery(); } }