// GET: Equipment/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Equipment equipment = db.Equipments.Find(id); if (equipment == null) { return(HttpNotFound()); } ViewBag.UnitsOfMeasure = new SelectList(db.UnitsOfMeasures.ToList(), "Name", "Name"); ViewBag.Sites = new SelectList(db.Sites.OrderBy(x => x.Code).ToList(), "Id", "CodeName"); ViewBag.Suppliers = new SelectList(db.Suppliers.OrderBy(x => x.Name), "Id", "Name"); ViewBag.Manufacturers = new SelectList(db.Manufacturers.OrderBy(x => x.Name), "Id", "Name"); ViewBag.Categories = new SelectList(db.PartCategories.OrderBy(x => x.Name), "Id", "Name"); ViewBag.TemporalUnit = EnumHelpers.AsSelectList <TemporalUnit>(); Membership.AddRecentEquipmentToUser(User.Identity.GetUserName(), equipment.Id); return(View(new EquipmentViewModel(equipment))); }