public ActionResult ConfirmEdit(Animals obj)
 {
     if (ModelState.IsValid)
     { // check valid state
         service.Update(obj);
         return(RedirectToAction("Index"));
     }
     else // not valid so redisplay
     {
         return(View(obj));
     }
 }
 public ActionResult ConfirmEdit(Animal obj)
 {
     if (ModelState.IsValid)
     {
         service.Update(obj);
         return(RedirectToAction("Index"));
     }
     else
     {
         return(View(obj));
     }
 }
Exemplo n.º 3
0
        public void TestUpdate()
        {
            var animalExisting = service.SelectByID(2);

            animalExisting.Name = "Bob";
            service.Update(animalExisting);

            var    animalUpdated = service.SelectByID(2);
            string animalName    = animalUpdated.Name;

            // Assert
            Assert.Equal("Bob", animalName);
        }
        public void TestUpdate()
        {
            ServiceSeeder.Seed(service);

            var beforeName = service.SelectByID(1);

            beforeName.AniName = "Test";

            service.Update(beforeName);

            var afterName = service.SelectByID(1);

            Assert.Equal("Test", afterName.AniName);
        }