// GET: Installations/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Installation installation = db.Installations.Find(id); if (installation == null) { return(HttpNotFound()); } ViewBag.Statuses = EnumHelpers.AsSelectList <InstallationPartStatus>(); ViewBag.LabourStatuses = EnumHelpers.AsSelectList <LabourStatus>(); ViewBag.Units = EnumHelpers.AsSelectList <TemporalUnit>(); ViewBag.HasMissingParts = installation.MissingParts.Count() != 0; Membership.AddRecentInstallationToUser(User.Identity.GetUserName(), installation.Id); return(View(installation)); }
// 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))); }