Esempio n. 1
0
        public async Task <CampingTripFull> Get(string id)
        {
            var identity = (ClaimsIdentity)User.Identity;
            IEnumerable <Claim> claims = identity.Claims;

            var role = claims.Where(claim => claim.Type == "role")?.FirstOrDefault();

            if (role?.Value == "Admin")
            {
                return(await campingTripRepository.GetCampingTripAsync(id));
            }
            else
            {
                return(await campingTripRepository.GetCampingTripForUserAsync(id));
            }
        }