title: Delete item from database with C# using HttpDelete
body: <p>I am trying to delete a row from my database based on a Primary Key ID field. When I try to do it, all of the code executes without any errors, but the item doesn't get deleted from the database. </p>
  
  <p>I'm passing the item to my C# backend from an angular frontend call like this: </p>
  
  <pre><code>delete(customerId: number, materialCustomerId: number): Observable&lt;Response&gt; {
      return this.http.delete(`${this.getBaseUrl()}/${customerId}/materialcustomer/${materialCustomerId}`).catch(error =&gt; this.handleError(error));
  }
  </code></pre>
  
  <p>It then hits my controller method: </p>
  
  <pre><code>    [HttpDelete]
      [Route("{customerId}/materialcustomer/{materialCustomerId}")]
      [AccessControl(Securable.Customer, Permissions.Delete, Permissions.Execute)]
      public async Task Delete(int customerId, int materialCustomerId)
      {
          await _materialCustomerDeleter.DeleteAsync(MaterialCustomer.CreateWithOnlyId(materialCustomerId), HttpContext.RequestAborted);
      }
  </code></pre>
  
  <p>Manipulator method: </p>
  
  <pre><code>public async Task DeleteAsync(MaterialCustomer model, CancellationToken cancellationToken = default(CancellationToken))
      {
          if (model == null)
              throw new ArgumentNullException(nameof(model));
  
          await _materialCustomerDeleter.DeleteAsync(new TblMaterialCustomer { MaterialCustomerId = model.MaterialCustomerId }, cancellationToken);
  
          if (cancellationToken.IsCancellationRequested)
              return;
  
          await _customerWriter.CommitAsync(cancellationToken);
      }
  </code></pre>
  
  <p>and finally, my repository method: </p>
  
  <pre><code>public async Task DeleteAsync(TblMaterialCustomer entity, CancellationToken cancellationToken = new CancellationToken())
      {
          var item =
              await _context.TblMaterialCustomer.FirstOrDefaultAsync(i =&gt; i.MaterialCustomerId == entity.MaterialCustomerId, cancellationToken);
  
          if (item == null || cancellationToken.IsCancellationRequested)
              return;
  
          _context.SetModified(item);
  
      }
  </code></pre>
  
  <p>What am I missing? </p>