Пример #1
0
 public void Create(Paciente entity)
 {
     CheckIsNull(entity);
     entity.Validate();
     CheckServiceIsValid(entity);
     CheckContainsByCpf(entity);
     _repository.Add(entity);
 }
Пример #2
0
 public IActionResult Create([FromBody] Paciente paciente)
 {
     if (paciente == null)
     {
         return(BadRequest()); //status code 400
     }
     pacienteRepository.Add(paciente);
     return(CreatedAtRoute("GetPaciente", new { id = paciente.id }, paciente));
 }
 public Int32 Create(PACIENTE item, LOG log)
 {
     using (DbContextTransaction transaction = Db.Database.BeginTransaction(IsolationLevel.ReadCommitted))
     {
         try
         {
             _logRepository.Add(log);
             _baseRepository.Add(item);
             transaction.Commit();
             return(0);
         }
         catch (Exception ex)
         {
             transaction.Rollback();
             throw ex;
         }
     }
 }
Пример #4
0
        public IActionResult Create([FromBody] Paciente paciente)
        {
            if (paciente == null)
            {
                return(BadRequest());
            }

            _pacienteRepositorio.Add(paciente);

            return(CreatedAtRoute("GetPaciente", new { id = paciente.Id }, paciente));
        }
        public async Task <ActionResult <Paciente> > PostPaciente([FromBody] Paciente paciente)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _repo.Add(paciente);
            var save = await _repo.SaveAsync(paciente);

            return(CreatedAtAction("GetPaciente", new { id = paciente.PacienteID }, paciente));
        }
Пример #6
0
        public IActionResult PostPaciente([FromBody] Paciente paciente)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _pacienteRepository.Add(paciente);
            _pacienteRepository.SaveChanges();

            return(CreatedAtAction("GetPaciente", new { id = paciente.idPaciente }, paciente));
        }
Пример #7
0
        public async Task <IActionResult> PostPaciente([FromBody] Paciente paciente)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            await _context.Add(paciente);

            await _context.SaveChanges();

            return(CreatedAtAction("GetPaciente", new { id = paciente.Id }, paciente));
        }
Пример #8
0
        public async Task <bool> Handle(CrearPacienteCommand request, CancellationToken cancellationToken)
        {
            var paciente = new Paciente(request.Apellidos, request.Nombres, request.Direccion, request.FechaNacimiento.ToDateTime(Constant.FORMAT_DDMMYYYY));

            paciente.EstadoActivo();

            _logger.LogInformation("----- Creando Paciente - Paciente: {@paciente}", paciente);

            _pacienteRepository.Add(paciente);

            return(await _pacienteRepository.UnitOfWork
                   .SaveEntitiesAsync(cancellationToken));
        }
Пример #9
0
 public void AddPaciente(Paciente p)
 {
     _pacienteRepository.Add(p);
 }