// GET: HumanVictims/Create
        public ActionResult HumanVictimForm(string biteId, string victimId)
        {
            var humanVicitmViewModel = new HumanVictimViewModel
            {
                HumanVictim = new HumanVictim(biteId),
                States      = _statesRepository.All(),
                Counties    = _countyRepository.All(),
                Cities      = _citiesRepository.All()
            };

            if (victimId != null)
            {
                humanVicitmViewModel.HumanVictim = _humanVictimRepository.GetById(victimId).Result;
            }

            return(View(humanVicitmViewModel));
        }
Beispiel #2
0
        // GET: PetOwners/Create
        public ActionResult PetOwnerForm(string animalId)
        {
            var petOwnerViewModel = new PetOwnerViewModel()
            {
                PetOwner = new PetOwner(),
                Animal   = _animalRepository.GetById(animalId).Result,
                States   = _statesRepository.All(),
                Counties = _countyRepository.All(),
                Cities   = _citiesRepository.All()
            };

            if (petOwnerViewModel.Animal.PetOwner != null)
            {
                var petOwnerDb = _petOwnerRepository.GetById(animalId).Result;

                if (petOwnerDb != null)
                {
                    petOwnerViewModel.PetOwner = petOwnerDb;
                }
            }
            return(View(petOwnerViewModel));
        }
        public async Task <ActionResult> BiteForm(string id)
        {
            var biteViewModel = new BiteViewModel
            {
                Bite         = new Bite(),
                Cities       = _citiesRepository.All(),
                States       = _statesRepository.All(),
                Employees    = _employeeRepository.All(),
                BiteStatuses = _biteStatusRepository.All()
            };

            if (id != null)
            {
                biteViewModel.Bite = await _biteRepository.GetById(id);


                if (biteViewModel.Bite == null)
                {
                    return(HttpNotFound());
                }
            }

            return(View(biteViewModel));
        }
Beispiel #4
0
        public Task <ExecuteResultEntity <ICollection <States> > > GetStateListAsync()
        {
            try
            {
                StatesRepository repo = RepositoryHelper.GetStatesRepository();
                return(Task.FromResult(ExecuteResultEntity <ICollection <States> > .CreateResultEntity(new Collection <States>(repo.All().ToList()))));
            }
            catch (Exception ex)
            {
                return(Task.FromResult(ExecuteResultEntity <ICollection <States> > .CreateErrorResultEntity(ex)));

                throw;
            }
        }