public async Task <IActionResult> PutProviderPatients(int id, ProviderPatients providerPatients) { if (id != providerPatients.ProviderId) { return(BadRequest()); } _context.Entry(providerPatients).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProviderPatientsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <ProviderPatients> > PostProviderPatients(ProviderPatients providerPatients) { _context.ProviderPatients.Add(providerPatients); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (ProviderPatientsExists(providerPatients.ProviderId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetProviderPatients", new { id = providerPatients.ProviderId }, providerPatients)); }