Exemplo n.º 1
0
        public IActionResult Update(string id, Coffee coffeeIn)
        {
            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());
            }

            _coffeeService.Update(id, coffeeIn);
            return(NoContent());
        }
 public Task <Coffee> Update(string id, [FromBody] Coffee coffee)
 {
     return(_coffeeService.Update(id, coffee));
 }