Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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();
            }
        }