// GET: PersonAvail/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PersonAvail personAvail = _repository.GetPersonAvailabilityById(id); if (personAvail == null) { return(HttpNotFound()); } PersonAvailViewModel personAvailVm = new PersonAvailViewModel() { PersonAvailDetail = personAvail, PersonName = _repository.GetPersonById(personAvail.PersonId) == null ? "" : _repository.GetPersonById(personAvail.PersonId).Name }; return(View(personAvailVm)); }