예제 #1
0
 public IActionResult Intake(AnimalIntakeViewModel animal)
 {
     try
     {
         //call animal service's create method to add a new animal to the database
     } catch (Exception ex)
     {
         ErrorViewModel error = new ErrorViewModel();
         error.Message = ex.Message;
         return(RedirectToAction("Error", "Home", error));
     }
     //on success redirect to Thank you/ sucess page
     return(View());
 }
예제 #2
0
        public IActionResult Intake()
        {
            AnimalIntakeViewModel model = new AnimalIntakeViewModel();

            try
            {
                model.SpeciesCollection  = _speciesService.GetAll();
                model.BreedCollection    = _breedService.GetAll();
                model.ColorCollection    = _colorService.GetAll();
                model.AnimalRestrictions = _animalRestrictionService.GetAll();
            } catch (Exception ex) {
                ErrorViewModel error = new ErrorViewModel();
                error.Message = ex.Message;
                return(RedirectToAction("Error", "Home", error));
            }
            return(View(model));
        }