public DraftApplicationUpdated(DraftApplicationId id, Content content, IncidentType incidentType, List <SuspiciousEmployee> suspiciousEmployees) : base(id.Value.ToString()) { this.Id = id; this.Content = content; this.IncidentType = incidentType; this.SuspiciousEmployees = suspiciousEmployees; }
public async void Delete(DraftApplicationId draftApplicationId) { if (draftApplicationId == null) { throw new ArgumentNullException(nameof(draftApplicationId)); } var draftApplication = await this._writeContext.DraftApplication.FirstAsync(x => x.Id == draftApplicationId); this._writeContext.DraftApplication.Remove(draftApplication); }
public static DraftApplication Create( Title tile, Content content, IncidentType incidentType, EmployeeId applicantId, List <EmployeeId> suspiciousEmployees) { var id = DraftApplicationId.Create(); var suspiciousEmployeesList = suspiciousEmployees.Select(x => new SuspiciousEmployee(x)).ToList(); var draftApplication = new DraftApplication(id, content, tile, incidentType, applicantId, suspiciousEmployeesList); draftApplication.AddDomainEvent(new DraftApplicationCreated(id, content, incidentType, applicantId, suspiciousEmployeesList)); return(draftApplication); }
public async Task <DraftApplication> GetById(DraftApplicationId draftApplicationId, CancellationToken cancellationToken) { if (draftApplicationId == null) { throw new ArgumentNullException(nameof(draftApplicationId)); } var draftApplication = await this._writeContext.DraftApplication .Include(nameof(DraftApplication.Attachments)).FirstAsync(x => x.Id == draftApplicationId, cancellationToken); if (draftApplication == null) { throw new AggregateNotFoundInDbException(nameof(Application), draftApplicationId.Value); } return(draftApplication); }
private DraftApplication( DraftApplicationId draftApplicationId, Content content, Title title, IncidentType incidentType, EmployeeId applicantId, List <SuspiciousEmployee> suspiciousEmployees) { this.CheckRule(new ApplicantCannotBeSuspectRule(suspiciousEmployees.Select(x => x.EmployeeId).ToList(), applicantId)); this.ApplicantId = Guard.Argument(applicantId, nameof(applicantId)).NotNull(); this.Content = Guard.Argument(content, nameof(content)).NotNull(); this.Title = Guard.Argument(title, nameof(title)).NotNull(); this.Id = Guard.Argument(draftApplicationId, nameof(draftApplicationId)).NotNull(); this.IncidentType = incidentType; this.SuspiciousEmployees = suspiciousEmployees; this.Attachments = new List <Attachment>(); }
public async Task <bool> IsExists(DraftApplicationId draftApplicationId, CancellationToken cancellationToken) { return(await this._writeContext.DraftApplication.AnyAsync(x => x.Id == draftApplicationId, cancellationToken)); }
public DraftApplicationAttachmentsAdded(DraftApplicationId draftApplicationId, List <Attachment> addedAttachments) : base(draftApplicationId.Value.ToString()) { this.DraftApplicationId = draftApplicationId; this.AddedAttachments = addedAttachments; }
public DraftApplicationAttachmentsDeleted(DraftApplicationId draftApplicationId, List <Attachment> deletedAttachments) : base(draftApplicationId.Value.ToString()) { this.DraftApplicationId = draftApplicationId; this.DeletedAttachments = deletedAttachments; }