public ActionResult Edit(int id = 0) { Princess princess = PrincessRepository.FindById(id); if (princess == null) { return(RedirectToAction("Index")); } return(View(princess)); }
public ActionResult Details(int id = 0) { Princess princess = PrincessRepository.FindById(id); if (princess == null) { return(HttpNotFound()); } return(View(princess)); }
public ActionResult Delete(int id = 0) { if (id > 0) { Princess princess = PrincessRepository.FindById(id); if (princess != null) { return(View(princess)); } } return(HttpNotFound()); }
public void RetrievePrincessById() { Princess expected = PersonFactory.CreatePrincess("Cendrion"); _context.Princesses.Add(expected); _context.SaveChanges(); Princess actual = PrincessRepository.FindById(expected.Id); ; Assert.AreEqual(expected, actual); }
public void ShouldNotRetrievePrincessWithId0() { Princess actual = PrincessRepository.FindById(0); Assert.IsNull(actual); }