public async Task WhenTheScheduleIsDeletedViaEntityFramework() { _dbContext.Entry(Sut).State = EntityState.Deleted; var result = await _dbContext.SaveChangesAsync(); Assert.IsTrue(result > 0); }
public async Task <IActionResult> PutResourceTimeRecurring(Guid key, ResourceTimeRecurring ResourceTimeRecurring) { if (key != ResourceTimeRecurring.ResourceTimeRecurringKey) { return(BadRequest()); } _dbContext.Entry(ResourceTimeRecurring).State = EntityState.Modified; try { await _dbContext.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ResourceTimeRecurringExists(key)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutAssociateSchedule(Guid key, AssociateSchedule AssociateSchedule) { if (key != AssociateSchedule.AssociateScheduleKey) { return(BadRequest()); } _dbContext.Entry(AssociateSchedule).State = EntityState.Modified; try { await _dbContext.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AssociateScheduleExists(key)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task Cleanup() { foreach (var item in RecycleBin) { _dbContext.Entry(item).State = EntityState.Deleted; await _dbContext.SaveChangesAsync(); } }