Ejemplo n.º 1
0
        public ICommandResult Handle(CreateNurseCommand 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);

            nurse.SetHospitalId(command.HospitalId);

            AddNotifications(nurse);

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

            _nurseRepository.Add(nurse);

            _uow.Commit();

            return(new CommandResult(true, "Sucesso!", nurse));
        }
Ejemplo n.º 2
0
 public void CreateNurse(Nurse Nurse, string userName)
 {
     Nurse.DateCreated       = DateTime.Now;
     Nurse.CreatedByUserName = userName;
     _repository.Add(Nurse);
 }