public async Task <IActionResult> PutEspecialidade([FromRoute] int id, [FromBody] Especialidade especialidade) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != especialidade.Id) { return(BadRequest()); } _context.Entry(especialidade).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EspecialidadeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <bool> AddAsync(Endereco endereco) { Endereco = endereco; _context.Endereco.Add(Endereco); await _context.SaveChangesAsync(); return(true); }
public async Task <bool> AddAsync(Especialidade especialidade) { Especialidade = especialidade; _context.Especialidade.Add(Especialidade); await _context.SaveChangesAsync(); return(true); }
public async Task <bool> AddAsync(Receita receita) { Receita = receita; _context.Receita.Add(Receita); await _context.SaveChangesAsync(); return(true); }
public async Task<bool> AddAsync(Paciente paciente) { Paciente = paciente; _context.Paciente.Add(Paciente); await _context.SaveChangesAsync(); return true; }
public async Task <bool> AddAsync(Medico medico) { Medico = medico; _context.Medico.Add(Medico); await _context.SaveChangesAsync(); return(true); }
public async Task <bool> AddAsync(Requisicao requisicao) { Requisicao = requisicao; _context.Requisicao.Add(Requisicao); await _context.SaveChangesAsync(); return(true); }
public async Task <bool> AddAsync(Consulta consulta) { Consulta = consulta; _context.Consulta.Add(Consulta); await _context.SaveChangesAsync(); return(true); }
public async Task <bool> AddAsync(Cobertura cobertura) { Cobertura = cobertura; _context.Cobertura.Add(Cobertura); await _context.SaveChangesAsync(); return(true); }
public async Task <IActionResult> PostCobertura([FromBody] Cobertura cobertura) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Cobertura.Add(cobertura); await _context.SaveChangesAsync(); return(CreatedAtAction("GetCobertura", new { id = cobertura.Id }, cobertura)); }
public async Task <PaymentJson> ProcessPayment([FromBody] PaymentModel model) { var payProcessing = new PaymentProcessing(_context, _acquirerApi, _accountApi, _log); var payment = model.Map(); if (!await payProcessing.Process(payment, model.AuthToken)) { return(new PaymentErrorJson(payProcessing)); } await _context.SaveChangesAsync(); return(new PaymentJson(payment)); }
public async Task <AdvanceJson> BeginAdvanceEvaluation([FromQuery] AdvanceEvaluationModel model) { var advProcessing = new AdvanceProcessing(_context, _acquirerApi, _accountApi, _log); var advance = model.Map(); try { advance = await advProcessing.BeginEvaluation(advance, model.AuthToken); } catch (Exception ex) { return(new AdvanceErrorJson(ex.Message)); } await _context.SaveChangesAsync(); return(new AdvanceJson(advance)); }
public async Task <IActionResult> DeleteEndereco([FromRoute] int id) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var endereco = await _context.Endereco.FindAsync(id); if (endereco == null) { return(NotFound()); } _context.Endereco.Remove(endereco); await _context.SaveChangesAsync(); return(Ok(endereco)); }