Пример #1
0
        // TODO breeze doesn't support this at the moment / coni2k - 31 Jul. '17
        // [ConcurrencyValidator(typeof(ResourcePool))]
        public async Task <IHttpActionResult> Delete(int key, Delta <ResourcePool> patch)
        {
            var resourcePool = await _resourcePoolManager.GetByIdAsync(key, true);

            // Owner check: Entity must belong to the current user
            var currentUserId = User.Identity.GetUserId <int>();

            if (currentUserId != resourcePool.UserId)
            {
                return(StatusCode(HttpStatusCode.Forbidden));
            }

            await _resourcePoolManager.DeleteAsync(resourcePool.Id);

            return(StatusCode(HttpStatusCode.NoContent));
        }