예제 #1
0
        public IActionResult Adopted()
        {
            List <Dog>          dogs;
            PartialDogInfoModel partialDog;
            AdoptedDogsModel    model = new AdoptedDogsModel();

            try
            {
                dogs = _repository.GetAdopted().OrderBy(d => d.Name).ToList();
                foreach (Dog d in dogs)
                {
                    partialDog = new PartialDogInfoModel(d);
                    model.Doggies.Add(partialDog);
                }
            }
            catch (Exception ex)
            {
                _repository.AddError(ex.Message);
                return(View("Error"));
            }
            return(View(model));
        }