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); }
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); }
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); }
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); }
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); }