Beispiel #1
0
        public Task <CourseData> Handle(UpdateCourse request)
        {
            Map(Course, request.Resource);

            return(Task.FromResult(new CourseData
            {
                Id = request.Resource.Id
            }));
        }
Beispiel #2
0
        public async Task <CourseData> Apply(UpdateCourse request, Func <UpdateCourse, Task <CourseData> > next)
        {
            using (var scope = _repository.Scopes.Create())
            {
                var data = request.Resource;
                if (Course == null && data != null)
                {
                    Course = await _repository.FetchByIdAsync <Course>(data.Id);

                    Env.Use(Course);
                }

                var result = await next(request);

                await scope.SaveChangesAsync();

                result.RowVersion = Course?.RowVersion;
                return(result);
            }
        }