예제 #1
0
        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));
        }
예제 #2
0
 // GET: GearCRUD/Edit/5
 public ActionResult Edit(int id)
 {
     return(View(_gearRep.GetById(id)));
 }