// TODO breeze doesn't support this at the moment / coni2k - 31 Jul. '17 // [ConcurrencyValidator(typeof(Element))] public async Task <IHttpActionResult> Delete(int key, Delta <Element> patch) { var element = await _resourcePoolManager .GetElementSet(key, true, item => item.ResourcePool) .SingleOrDefaultAsync(); // Owner check: Entity must belong to the current user var currentUserId = User.Identity.GetUserId <int>(); if (currentUserId != element.ResourcePool.UserId) { return(StatusCode(HttpStatusCode.Forbidden)); } await _resourcePoolManager.DeleteElementAsync(element.Id); return(StatusCode(HttpStatusCode.NoContent)); }