public IActionResult Get(int id) { var gear = _gearRepository.GetById(id); if (gear == null) { return(NotFound()); } // Only the owner can access gear that is inactive, or that belongs to an inactive owner if (!gear.IsActive || !gear.UserProfile.IsActive) { try { var currentUser = GetCurrentUserProfile(); if (currentUser == null || gear.UserProfileId != currentUser.Id) { return(NotFound()); } } catch { return(NotFound()); } } return(Ok(gear)); }
// GET: GearCRUD/Edit/5 public ActionResult Edit(int id) { return(View(_gearRep.GetById(id))); }