public virtual async Task Approved(Course course, CourseLesson lesson, Customer customer) { var action = await _courseActionService.GetCourseAction(customer.Id, lesson.Id); if (action == null) { await _courseActionService.InsertAsync(new CourseAction() { CustomerId = customer.Id, CourseId = course.Id, LessonId = lesson.Id, Finished = true }); } else { action.Finished = true; await _courseActionService.Update(action); } }
public async Task <bool> Handle(CourseLessonApprovedCommand request, CancellationToken cancellationToken) { var action = await _courseActionService.GetCourseAction(request.Customer.Id, request.Lesson.Id); if (action == null) { await _courseActionService.InsertAsync(new CourseAction() { CustomerId = request.Customer.Id, CourseId = request.Course.Id, LessonId = request.Lesson.Id, Finished = true }); } else { action.Finished = true; await _courseActionService.Update(action); } return(true); }