public async Task <IActionResult> PutListCr(int id, ListCr listCr) { if (id != listCr.IdCr) { return(BadRequest()); } _context.Entry(listCr).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ListCrExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <ListCr> > PostListCr(ListCr listCr) { _context.ListCrs.Add(listCr); await _context.SaveChangesAsync(); return(CreatedAtAction("GetListCr", new { id = listCr.IdCr }, listCr)); }
public void Remove(string id_cr, string id_student) { using (RegisterSubjectDBContext db = new RegisterSubjectDBContext()) { ListCr s = db.ListCrs.SingleOrDefault(x => x.IdClassRegister == id_cr && x.IdStudent == id_student); db.ListCrs.Remove(s); db.SaveChanges(); } }