public void Create(Paciente entity) { CheckIsNull(entity); entity.Validate(); CheckServiceIsValid(entity); CheckContainsByCpf(entity); _repository.Add(entity); }
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; } } }
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)); }
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)); }
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)); }
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)); }
public void AddPaciente(Paciente p) { _pacienteRepository.Add(p); }