public void SetTypes(Get_or_Set_types type) { string sqlexpression = "type_insert"; using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); SqlCommand command = new SqlCommand(sqlexpression, connection); command.CommandType = CommandType.StoredProcedure; SqlParameter IdParam = new SqlParameter { ParameterName = "@id", Value = type.Id }; command.Parameters.Add(IdParam); /*SqlParameter TypeIdParam = new SqlParameter * { * * }; * command.Parameters.Add(TypeIdParam);*/ SqlParameter TypeNameParam = new SqlParameter { ParameterName = "@type", Value = type.Type }; command.Parameters.Add(TypeNameParam); SqlParameter InfoParam = new SqlParameter { ParameterName = "@info", Value = type.Info }; command.Parameters.Add(InfoParam); try { command.ExecuteNonQuery(); } catch { } connection.Close(); } }
public List <Get_or_Set_types> GetTypes() { List <DishClassLibrary.temp.test.Get_or_Set_types> list = new List <DishClassLibrary.temp.test.Get_or_Set_types>(); string sqlexpression = "type_get"; using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); SqlCommand command = new SqlCommand(sqlexpression, connection); // указываем, что команда представляет хранимую процедуру command.CommandType = System.Data.CommandType.StoredProcedure; var reader = command.ExecuteReader(); while (reader.Read()) { Get_or_Set_types type = new Get_or_Set_types(); type.Id = reader.GetInt32(0); type.Type = reader.GetString(1); type.Info = reader.GetString(2); list.Add(type); } reader.Close(); } return(list); }
public void SetType(Get_or_Set_types type) { dal.SetTypes(type); }
public ActionResult SetType(Get_or_Set_types type) { bis_log.SetType(type); return(RedirectToAction("Mainpage")); }
public ActionResult SetType() { Get_or_Set_types type = new Get_or_Set_types(); return(View(type)); }