Example #1
0
            public async Task <Response> Handle(Command request, CancellationToken cancellationToken)
            {
                var validator = new CommandValidator();
                await validator.ValidateAndThrowAsync(request, cancellationToken : cancellationToken);

                var project = new Project(request.Name !);
                var id      = await _timeSheetService.CreatProject(project);

                return(new Response {
                    Id = id
                });
            }
Example #2
0
            public async Task <Response> Handle(Command request, CancellationToken cancellationToken)
            {
                var validator = new CommandValidator();
                await validator.ValidateAndThrowAsync(request, cancellationToken : cancellationToken);

                var timeSheet = new TimeSheet(
                    request.ProjectId,
                    request.ActivityId,
                    request.DurationInMins,
                    request.StartedAt,
                    request.Details
                    );
                var id = await _timeSheetService.CreateTimeSheet(timeSheet);

                return(new Response {
                    TimeSheetId = id
                });
            }