/// <inheritdoc/> public async Task CreateCommitteeAsync( IWho who, IAuditHeaderWithAuditDetails auditHeader, ICommittee committee) { this.logger.ReportEntry( who, new { Committee = committee }); CommitteeDto dto = CommitteeDto.ToDto(committee); this.context.Committees.Add(dto); await this.context.SaveChangesAsync().ConfigureAwait(false); Audit.AuditCreate(auditHeader, dto, dto.Id); this.logger.ReportExit(who); }
/// <inheritdoc/> public async Task UpdateCommitteeAsync( IWho who, IAuditHeaderWithAuditDetails auditHeader, ICommittee committee) { this.logger.ReportEntry( who, new { Committee = committee }); CommitteeDto dto = CommitteeDto.ToDto(committee); CommitteeDto original = await this.context.FindAsync <CommitteeDto>(committee.Id); Audit.AuditUpdate(auditHeader, dto.Id, original, dto); this.context.Entry(original).CurrentValues.SetValues(dto); await this.context.SaveChangesAsync().ConfigureAwait(false); this.logger.ReportExit(who); }
public void Test_Passing_Valid_Values() { // ARRANGE ICommittee committee = new Committee( id: Guid.NewGuid(), organisation: new Organisation( id: Guid.NewGuid(), code: "CBC", name: "County Bridge Club", bgColour: "000000"), name: "TSC", description: "Tournament Sub-Committee"); // ACT CommitteeDto committeeDto = CommitteeDto.ToDto(committee); // ASSERT Assert.AreEqual(committee.Id, committeeDto.Id); Assert.AreEqual(committee.Organisation.Id, committeeDto.OrganisationId); Assert.AreEqual(committee.Name, committeeDto.Name); Assert.AreEqual(committee.Description, committeeDto.Description); }