Пример #1
0
        public ActionResult <Coffee> Get(string id)
        {
            var identity = User.Identity as ClaimsIdentity;
            var userId   = identity.Claims.First((c) => c.Type == ClaimTypes.PrimarySid);
            var coffee   = _coffeeService.GetWithId(id);

            if (coffee == null || !coffee.UserId.Equals(userId.Value))
            {
                return(NotFound());
            }

            return(coffee);
        }