public async Task <ActionResult <ScheduleLessons> > PostScheduleLessons(ScheduleLessons scheduleLessons) { _context.ScheduleLessons.Add(scheduleLessons); await _context.SaveChangesAsync(); return(CreatedAtAction("GetScheduleLessons", new { id = scheduleLessons.Id }, scheduleLessons)); }
public async Task <IActionResult> PutScheduleLessons(int id, ScheduleLessons scheduleLessons) { if (id != scheduleLessons.Id) { return(BadRequest()); } _context.Entry(scheduleLessons).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ScheduleLessonsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }