Exemple #1
0
        /// <summary>
        /// 登録処理
        /// </summary>
        private void addDrugInfo()
        {
            using (var db = new DrugInfoContext())
            {
                var drug = new Drugs();
                drug.DrugCode         = "";
                drug.Name             = this.txtName.Text;
                drug.Company          = this.txtCompany.Text;
                drug.ClassificationId = (int)this.cmbClassification.SelectedValue;

                db.Drugs.Add(drug);
                db.SaveChanges();
            }
        }
        /// <summary>
        /// 登録処理
        /// </summary>
        private void addDrugInfo()
        {
            using (var db = new DrugInfoContext())
            {
                var drug = new Drugs();
                drug.DrugCode = "";
                drug.Name = this.txtName.Text;
                drug.Company = this.txtCompany.Text;
                drug.ClassificationId = (int)this.cmbClassification.SelectedValue;

                db.Drugs.Add(drug);
                db.SaveChanges();
            }
        }