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(); } }
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)); }