Пример #1
0
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            SpecialityWindow specialityWindow = new SpecialityWindow(new Speciality());

            if (specialityWindow.ShowDialog() == true)
            {
                Speciality speciality = specialityWindow.Speciality;
                db.Specialities.Add(speciality);
                db.SaveChanges();
            }
        }
Пример #2
0
        public ActionResult Create([Bind(Include = "Id,Name,Kod")] Speciality speciality)
        {
            if (ModelState.IsValid)
            {
                db.Specialitys.Add(speciality);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(speciality));
        }