public ActionResult Edit(int?Id) { if (Id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Widget model = repositoryWidget.Details(Id); // model.UserDetails.FName if (model == null) { return(HttpNotFound()); } return(View("UpdateWidget", model)); }