public async Task Handle(CreateJobAssignFromJobAssignCommand message) { try { var item = await repository.Get(message.Id); if (item != null) { throw new Exception($"JobAssign task with id: {message.Id} already exist"); } } catch (AggregateNotFoundException) { // That is fine that id not used } if (message.RewriteChangedByWeeks) { CopyWeekListFromGlobalAssign(message.WeekList); } var jobAssign = JobAssignDomain.Create(message.Id, message.HousingDepartmentIdList, message.Description, message.TillYear, message.RepeatsPerWeek, message.CreatedByRole, message.ChangedByRole, message.WeekList, message.UploadList, message.DayPerWeekList, message.JobIdList, message.IsGlobal, message.IsLocked, message.JobResponsibleLIst); await repository.Save(jobAssign); }
public async Task Handle(CreateJobAssignCommand message) { try { var item = await repository.Get(message.Id.ToString()); if (item != null) { throw new Exception($"JobAssign with id: {message.Id} already exist"); } } catch (AggregateNotFoundException) { // That is fine that id not used } var jobAssign = JobAssignDomain.Create(message.Id, new List <string> { message.JobId }, message.CreatedByRole, message.TillYear); await repository.Save(jobAssign); }