// GET: Bites/Details/5 public async Task <ActionResult> Details(string biteId, Constant.ManageMessageId?message) { ViewBag.StatusMessage = message == Constant.ManageMessageId.SavedBiteDataSuccess ? "Bite data saved successfully." : message == Constant.ManageMessageId.SaveHumanVictimDataSuccess ? "Victim data saved successfully." : message == Constant.ManageMessageId.DeleteHumanVictimSuccess ? "Victim deleted successfully." : message == Constant.ManageMessageId.ErrorHumanVictimData ? "Error saving Victim data." : message == Constant.ManageMessageId.SavePetVictimDataSuccess ? "Pet data saved successfully" : message == Constant.ManageMessageId.DeletePetVictimSuccess ? "Pet data deleted successfully" : ""; if (biteId == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Bite bite = await _biteRepository.GetById(biteId); if (bite == null) { return(HttpNotFound()); } var bitedetailsViewModel = new BiteDetailsViewModel { Bite = bite, HumanVictims = _humanVictimRepository.GetAllByBiteId(biteId), Pets = _animalRepository.GetAllPetVictims(biteId), Animal = _animalRepository.GetAnimalByBiteId(biteId), PetOwner = bite.Animals.First(a => a.IsVictim.Equals(false)).PetOwner, Actions = _actionRepository.GetActionsByBiteId(biteId) }; return(View(bitedetailsViewModel)); }