public void Get_By_Id_Returns_Existing() { Rating r = new Rating(); r.Description = "TestReturn"; int id = manager.Create(r); var actual = manager.GetById(id); Assert.IsNotNull(actual); Assert.AreEqual("TestReturn", actual.Description); }
protected void AddButton_Click(object sender, EventArgs e) { RatingManager manager = new RatingManager(); Rating rating = new Rating { Description = RatingTextBox.Text }; manager.Create(rating); DoDataBind(); manager.Dispose(); }
public ActionResult Create(Rating rating) { if (ModelState.IsValid) { using (manager = new RatingManager()) { manager.Create(rating); } if (rating == null) { return(HttpNotFound()); } else { return(RedirectToAction("Index")); } } else { return(View(rating.Id)); } }