public ActionResult CreateVetura(VeturaCreate vetura) { if (ModelState.IsValid) { DAL_Vetura.AddVetura(vetura); } return(RedirectToAction("Index", "Brendis")); }
public static void AddVetura(VeturaCreate vetura) { using (SqlConnection con = new SqlConnection(ConnectionWithDB.GetConnection())) { SqlCommand cmd = new SqlCommand("usp_AddVetura", con); cmd.CommandType = System.Data.CommandType.StoredProcedure; con.Open(); cmd.Parameters.AddWithValue("@BrendiID", vetura.BrendiID); cmd.Parameters.AddWithValue("@Emri", vetura.Emri); cmd.ExecuteNonQuery(); } }