async Task <EntityModel> SetStatusAsync(Guid id, Status status) { EntityModel entity; using (var db = this.db.CreateDbContext()) { entity = await db.TokenReceivingWatcherWatches.SingleAsync(e => e.Id == id); entity.Status = status; await db.SaveChangesAsync(); } return(entity); }
async Task <IReadOnlyDictionary <DomainModel, int> > CompleteAsync( Expression <Func <EntityModel, bool> > criteria, Status status, CancellationToken cancellationToken) { var entities = await UpdateAsync(criteria, e => e.Status = status, cancellationToken); var completed = new Dictionary <DomainModel, int>(); foreach (var entity in entities) { var domain = await ToDomainAsync(entity, CancellationToken.None); completed.Add(domain, entity.Confirmation); } return(completed); }