コード例 #1
0
        public ICommandResult Handle(UpdateNurseCommand command)
        {
            command.Validate();

            if (command.Invalid)
            {
                AddNotifications(command);
                return(new CommandResult(false, command.Notifications.Messages(), command));
            }

            Nurse nurse = new Nurse(command.FullName, command.CpfNumber, command.Coren, command.BirthDate.Value, command.DocumentType)
            {
                Id = command.Id
            };

            nurse.SetHospitalId(command.HospitalId);

            AddNotifications(nurse);

            if (Invalid)
            {
                return(new CommandResult(false, nurse.Notifications.Messages(), command));
            }

            _nurseRepository.Update(nurse);

            _uow.Commit();

            return(new CommandResult(true, "Sucesso!", nurse));
        }