public async Task <IActionResult> PutToothToothSurface(int id, ToothToothSurface toothToothSurface) { if (id != toothToothSurface.ToothId) { return(BadRequest()); } _context.Entry(toothToothSurface).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ToothToothSurfaceExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <ToothToothSurface> > PostToothToothSurface(ToothToothSurface toothToothSurface) { _context.ToothToothSurface.Add(toothToothSurface); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (ToothToothSurfaceExists(toothToothSurface.ToothId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetToothToothSurface", new { id = toothToothSurface.ToothId }, toothToothSurface)); }