public virtual void Delete(T entity) { if (RepositoryContext.Entry(entity).State == EntityState.Detached) { DWDbSet.Attach(entity); } DWDbSet.Remove(entity); }
public async Task <IActionResult> PutStudent(string id, Student student) { if (id != student.EmployeeId) { return(BadRequest()); } _context.Entry(student).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StudentExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }