public void Get_By_Id_Returns_Existing() { Director d = new Director(); d.FirstName = "TestReturn"; d.LastName = "Test"; int id = manager.Create(d); var actual = manager.GetById(id); Assert.IsNotNull(actual); Assert.AreEqual("TestReturn", actual.FirstName); }
protected void AddButton_Click(object sender, EventArgs e) { DirectorManager manager = new DirectorManager(); Director director = new Director { FirstName = FirstNameTextBox.Text, LastName = LastNameTextBox.Text }; manager.Create(director); DoDataBind(); manager.Dispose(); }
public ActionResult Create(Director director) { if (ModelState.IsValid) { using (manager = new DirectorManager()) { manager.Create(director); } if (director == null) { return(HttpNotFound()); } else { return(RedirectToAction("Index")); } } else { return(View(director.Id)); } }