public async Task <IActionResult> PutFurnitures(int id, Furnitures furnitures) { if (id != furnitures.FurnitureId) { return(BadRequest()); } _context.Entry(furnitures).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FurnituresExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> DeleteWorker([FromRoute] int workerId) { var worker = await _context.Workers.FirstOrDefaultAsync(w => w.WorkerId == workerId); if (worker == null) { return(NotFound()); } _context.Entry(worker).State = EntityState.Deleted; await _context.SaveChangesAsync(); return(NoContent()); }
public async Task <ActionResult <Details> > PutDetails(Details details) { var detail = await _context.Details.FirstOrDefaultAsync(d => d.DetailId == details.DetailId); if (detail == null) { return(NotFound()); } _context.Entry(detail).State = EntityState.Modified; await _context.SaveChangesAsync(); return(Ok(detail)); }