Finished #221 and added more async #278

This commit is contained in:
tidusjar 2016-05-31 16:16:48 +01:00
parent 4114a8e9ba
commit 5b7e4aa5e3
6 changed files with 129 additions and 53 deletions

View file

@ -161,16 +161,26 @@ namespace PlexRequests.Core
.ToList();
}
public bool BatchUpdate(List<RequestedModel> model)
public bool BatchUpdate(IEnumerable<RequestedModel> model)
{
var entities = model.Select(m => new RequestBlobs { Type = m.Type, Content = ByteConverterHelper.ReturnBytes(m), ProviderId = m.ProviderId, Id = m.Id }).ToList();
return Repo.UpdateAll(entities);
}
public bool BatchDelete(List<RequestedModel> model)
public async Task<bool> BatchUpdateAsync(IEnumerable<RequestedModel> model)
{
var entities = model.Select(m => new RequestBlobs { Type = m.Type, Content = ByteConverterHelper.ReturnBytes(m), ProviderId = m.ProviderId, Id = m.Id }).ToList();
return await Repo.UpdateAllAsync(entities);
}
public bool BatchDelete(IEnumerable<RequestedModel> model)
{
var entities = model.Select(m => new RequestBlobs { Type = m.Type, Content = ByteConverterHelper.ReturnBytes(m), ProviderId = m.ProviderId, Id = m.Id }).ToList();
return Repo.DeleteAll(entities);
}
public async Task<bool> BatchDeleteAsync(IEnumerable<RequestedModel> model)
{
var entities = model.Select(m => new RequestBlobs { Type = m.Type, Content = ByteConverterHelper.ReturnBytes(m), ProviderId = m.ProviderId, Id = m.Id }).ToList();
return await Repo.DeleteAllAsync(entities);
}
}
}