public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, "id should not be null.")); } var data = repo.GetCustomerById(id.Value); if (data != null) { ViewData.Model = data; return(View()); } else { return(HttpNotFound("Not found customer.")); } }