コード例 #1
0
 private Task ApplyUpdateRequest(Department d, UpdateDepartment update)
 {
     d.Name            = update.Name;
     d.Budget          = update.Budget;
     d.AdministratorId = update.AdministratorId;
     d.StartDate       = update.StartDate;
     return(_departmentRepository.Update(d));
 }
コード例 #2
0
 private async Task <Validation <Error, Department> > Validate(UpdateDepartment update) =>
 (ValidateDepartmentName(update), ValidateBudget(update), MustStartInFuture(update),
コード例 #3
0
 public Task <Either <Error, Task> > Handle(UpdateDepartment request, CancellationToken cancellationToken) =>
 Validate(request)
 .MapT(d => ApplyUpdateRequest(d, request))
 .Map(v => v.ToEither <Task>());