示例#1
0
        public List <MedicamenteModel> GetMedicamente()
        {
            SqlConnection connection = new SqlConnection();

            connection.ConnectionString = ConnectionString;


            SqlCommand command = new SqlCommand(GetAllMedicamentQuery, connection);

            //command.Parameters.AddWithValue("@pricePoint", paramValue);

            connection.Open();
            SqlDataReader reader = command.ExecuteReader();

            List <MedicamenteModel> medicamenteList = new List <MedicamenteModel>();

            while (reader.Read())
            {
                MedicamenteModel Medicament = new MedicamenteModel();
                Medicament.Id   = reader.GetInt32(0);
                Medicament.Name = reader.GetString(1);


                medicamenteList.Add(Medicament);
            }

            reader.Close();

            connection.Close();

            return(medicamenteList);
        }
        public ActionResult Add(MedicamenteModel medicament)
        {
            MedicamenteRepository r = new MedicamenteRepository();

            r.Add(medicament);

            return(View("SuccesfulAdd"));
        }
示例#3
0
        public void Add(MedicamenteModel medicament)
        {
            using (var db = new LiteDatabase(@"c:\temp\MedicamenteDB.db"))
            {
                // Get customer collection
                var Medicamente = db.GetCollection <MedicamenteModel>("medicamente");

                Medicamente.Insert(medicament);
            }
        }
示例#4
0
        public void AddBook(MedicamenteModel medicament)
        {
            SqlConnection connection = new SqlConnection();

            connection.ConnectionString = ConnectionString;


            SqlCommand command = new SqlCommand(InsertMedicamentQuery, connection);

            command.Parameters.Add("@name", SqlDbType.VarChar).Value = medicament.Name;


            connection.Open();
            command.ExecuteNonQuery();

            connection.Close();
        }