public async Task <IActionResult> Puttrainning(int id, trainning trainning) { if (id != trainning.id) { return(BadRequest()); } _context.Entry(trainning).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!trainningExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <trainning> > Posttrainning(trainning trainning) { _context.trainnings.Add(trainning); await _context.SaveChangesAsync(); return(CreatedAtAction("Gettrainning", new { id = trainning.id }, trainning)); }
public async Task <IActionResult> Disable(int id) { trainning b = _context.trainnings.FirstOrDefault(u => u.id == id && u.status == true); if (b != null) { b.status = false; } else { b = null; } try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!trainningExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }