public async Task <IActionResult> PutBeadsToEmbs(long id, BeadsToEmbs beadsToEmbs) { var r = _context.BeadsToEmbs.Where(b => b.BeadId == beadsToEmbs.BeadId && b.EmbroidericId == beadsToEmbs.EmbroidericId).FirstOrDefault(); if (r == null) { if (id != beadsToEmbs.Id) { return(BadRequest()); } _context.Entry(beadsToEmbs).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BeadsToEmbsExists(id)) { return(NotFound()); } else { throw; } } } return(NoContent()); }
public async Task <ActionResult <BeadsToEmbs> > PostBeadsToEmbs(BeadsToEmbs beadsToEmbs) { var r = _context.BeadsToEmbs.Where(b => b.BeadId == beadsToEmbs.BeadId && b.EmbroidericId == beadsToEmbs.EmbroidericId).FirstOrDefault(); if (r == null) { _context.BeadsToEmbs.Add(beadsToEmbs); await _context.SaveChangesAsync(); } return(CreatedAtAction("GetBeadsToEmbs", new { id = beadsToEmbs.Id }, beadsToEmbs)); }