public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var entity = _elementService.GetById(id.Value); if (entity == null) { return(HttpNotFound()); } var viewmodel = Mapper.Map <Element, ElementDetailsViewModel>(entity); return(View(viewmodel)); }