示例#1
0
        public object DeleteChildren(string id)
        {
            Child child = UOW.ChildrenRepository.Where(p => p.id.ToString().Equals(id)).First();

            child.isActive = false;
            UOW.ChildrenRepository.Update(child);
            UOW.Commit();
            return(true);
        }
示例#2
0
        protected override async Task RunCommand(CreateCourse command, CancellationToken cancellationToken)
        {
            var newCourse = new Course(command.CourseId, command.CourseTitle);
            await _unitOfWork.CoursesRepository.CreateAsync(newCourse, cancellationToken);

            await _unitOfWork.Commit(cancellationToken);
        }
示例#3
0
        protected override async Task RunCommand(CreateStudent command, CancellationToken cancellationToken)
        {
            var newCourse = new Student(command.StudentId, command.StudentFirstname, command.StudentLastname);
            await _unitOfWork.StudentsRepository.Create(newCourse, cancellationToken);

            await _unitOfWork.Commit(cancellationToken);
        }
示例#4
0
        protected override async Task RunCommand(Withdraw command, CancellationToken cancellationToken)
        {
            var course = await _unitOfWork.CoursesRepository.FindByIdAsync(command.CourseId, cancellationToken);

            var student = await _unitOfWork.StudentsRepository.FindById(command.StudentId, cancellationToken);

            student.Cancel(course);
            await _unitOfWork.Commit(cancellationToken);
        }
示例#5
0
        public ApiResponse <Person> Create(Person person)
        {
            var response = new ApiResponse <Person> {
            };

            schoolUnitOfWork.PersonRepository.Add(person);

            var course = new Course {
                CourseName = "My Course"
            };

            schoolUnitOfWork.CourseRepository.Add(course);

            schoolUnitOfWork.Commit();
            response.Data = person;
            return(response);
        }