コード例 #1
0
        public ActionResult Create(Allergies model)
        {
            try
            {
                var obj = new Allergies()
                {
                    Allergy = model.Allergy
                };

                db.tabAllergies.Add(obj);
                db.SaveChanges();
                return null;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #2
0
        public ActionResult Edit(Allergies model)
        {
            try
            {
                Allergies allergies = db.tabAllergies.Find(model.AllergyId);

                allergies.Allergy = model.Allergy;

                db.Entry(allergies).State = EntityState.Modified;
                db.SaveChanges();
                return PartialView("Create");
            }
            catch (Exception)
            {

                throw;
            }
        }