コード例 #1
0
        public async Task <ICommandExit> Handler(UpdateNurseCommand command)
        {
            Nurse nurse = await _nurseRepository.GetById(command.Id);

            nurse.UpdateNurse(command.Name, command.CPF, command.BirthDate, command.Coren, command.Id_Hospital);
            if (Invalid)
            {
                return(new CommandExit(false, "Erro ao cadastrar Nurse", nurse));
            }

            await Task.Factory.StartNew(() =>
            {
                _nurseRepository.Update(nurse);
            });

            return(new CommandExit(true, "Atualização Realizado Com Sucesso", nurse));
        }
コード例 #2
0
ファイル: NurseHandler.cs プロジェクト: Llimaa/EnferDev
        public async Task <ICommandResult> Handler(UpdateNurseCommand command)
        {
            command.Validate();
            if (!command.Valid)
            {
                return(new GenericCommandResult(false, "Ops, parece que algo está errado!", command.Notifications));
            }

            var nurse = await _nurseRepository.GetById(command.Id);

            nurse.updateNurse(command.Name, command.CPF, command.Coren, command.DateBirth);

            if (nurse.Invalid)
            {
                return(new GenericCommandResult(false, "ocoreu algum erro", command.Notifications));
            }

            await _nurseRepository.Update(nurse);

            return(new GenericCommandResult(true, "Dados do Enfermeiro atualizado", nurse));
        }
コード例 #3
0
ファイル: NurseController.cs プロジェクト: Llimaa/EnferDev
        public async Task <IActionResult> GetById(Guid id, [FromServices] INurseRepository repository)
        {
            var result = await repository.GetById(id);

            return(Ok(_mapper.Map <NurseViewModel>(result)));
        }
コード例 #4
0
 public Nurse GetNurse(string id)
 {
     return(_repository.GetById(id));
 }
コード例 #5
0
        public Nurse GetById(Guid id)
        {
            var Nurse = _repository.GetById(id);

            return(Nurse);
        }