public async Task <ActionResult <LecAndStudent> > PostLecAndStudent(LecAndStudent lecAndStudent) { _context.LecAndStudents.Add(lecAndStudent); await _context.SaveChangesAsync(); return(CreatedAtAction("GetLecAndStudent", new { id = lecAndStudent.Id }, lecAndStudent)); }
public async Task <IActionResult> PutLecAndStudent(int id, LecAndStudent lecAndStudent) { if (id != lecAndStudent.Id) { return(BadRequest()); } _context.Entry(lecAndStudent).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LecAndStudentExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }