protected async Task <IActionResult> DeleteAsync(DeleteArguments <TEntity> arguments) { var query = this.context.Set <TEntity>() .AsTracking(); if (this.DefaultPredicate != null) { query = query.Where(this.DefaultPredicate); } if (arguments.Predicate != null) { query = query.Where(arguments.Predicate); } var entity = await query .SingleOrDefaultAsync(); if (entity == null) { return(this.NotFound()); } var assertionResult = arguments.Assertion?.Invoke(entity); if (assertionResult != null) { return(assertionResult); } if (typeof(DAL.IHasSoftDelete).IsAssignableFrom(typeof(TEntity)) && !arguments.ForceHardDelete) { arguments.SoftDeleteAction?.Invoke(entity); (entity as DAL.IHasSoftDelete).IsDeleted = true; } else { context.Remove(entity); } await this.context.SaveChangesAsync(); return(this.Ok()); }
public void Delete(EphorteIdentity identity, DeleteArguments arguments) { throw new NotImplementedException(); }