コード例 #1
0
        public List <CasaFarmaceutica> GetAllCasasFarmaceuticas()
        {
            System.Data.SqlClient.SqlConnection conn;
            SqlCommand    command;
            SqlDataReader read;

            conn = new SqlConnection("Data Source=(local);Initial Catalog=Proyecto1;Integrated Security=True");
            conn.Open();
            command = new SqlCommand("SELECT *  from CasaFarmaceutica where LogicDelete = 0", conn);
            read    = command.ExecuteReader();

            List <CasaFarmaceutica> cFarmaceuticas = new List <CasaFarmaceutica>();

            while (read.Read())
            {
                CasaFarmaceutica cFar = new CasaFarmaceutica();
                cFar.IdCasaFarmaceutica = Convert.ToInt32(read["IdCasaFarmaceutica"]);
                cFar.Nombre             = read["Nombre"].ToString();

                cFarmaceuticas.Add(cFar);
            }
            read.Close();
            conn.Close();
            return(cFarmaceuticas);
        }
コード例 #2
0
        public void PostCasaFarmaceutica([FromBody] CasaFarmaceutica cFar)
        {
            System.Data.SqlClient.SqlConnection conn;
            SqlCommand command;

            conn = new SqlConnection("Data Source=(local);Initial Catalog=Proyecto1;Integrated Security=True");
            conn.Open();

            command = new SqlCommand("insert  CasaFarmaceutica(Nombre) VALUES (@Nombre)", conn);

            command.Parameters.AddWithValue("@Nombre", cFar.Nombre);
            command.ExecuteNonQuery();

            conn.Close();
        }
コード例 #3
0
        public void PostCasaFarmaceutica([FromBody] CasaFarmaceutica cFar)
        {
            CasaFarmaceuticaService con = new CasaFarmaceuticaService();

            con.PostCasaFarmaceutica(cFar);
        }