public async Task <bool> DeleteAsync(string keyValue, string connectionString = null) { using (SystemContext context = DataBaseConfig.CreateContext(connectionString)) { context.Set <T>().Remove(context.Find <T>(keyValue)); return(await context.SaveChangesAsync() > 0); } }
public async Task <bool> DeleteAsync(IEnumerable <T> entityList, string connectionString = null) { using (SystemContext context = DataBaseConfig.CreateContext(connectionString)) { context.Set <T>().RemoveRange(entityList); return(await context.SaveChangesAsync() > 0); } }
public async Task <bool> UpdateAsync(T entity, string connectionString = null) { using (SystemContext context = DataBaseConfig.CreateContext(connectionString)) { context.Update(entity); return(await context.SaveChangesAsync() > 0); } }