public ICommandResult Handler(AddSpecialtyCommand command)
        {
            Specialty specialty = _specialtyRepository.GetById(command.SpecialtylId);
            Hospital  hospital  = _hospitalRepository.GetById(command.HospitalId);

            hospital.AddSpecialty(specialty);
            if (!hospital.IsValid())
            {
                return(null);
            }
            _hospitalRepository.AddSpecialty(hospital, command.SpecialtylId);
            return(new StandardHospitalCommandResult(hospital.Id, DateTime.Now));
        }
Ejemplo n.º 2
0
        public HospitalFakeRepository(SpecialtyFakeRepository specialtyFakeRepository = null)
        {
            specialtyFakeRepository = specialtyFakeRepository ?? new SpecialtyFakeRepository();

            Specialty specialty = specialtyFakeRepository.specialties[0];
            Hospital  hospital  = new Hospital("São Lucas");

            hospital.AddSpecialty(specialty);

            Hospital hospital2 = new Hospital("Dom Orione");

            hospitals.Add(hospital);
            hospitals.Add(hospital2);
        }