public virtual T Update(T t, object key) { if (t == null) { return(null); } T exist = _context.Set <T>().Find(key); if (exist != null) { _context.Entry(exist).CurrentValues.SetValues(t); //_context.SaveChanges(); } return(exist); }
public async Task <IActionResult> PutAmendmentReason([FromRoute] int id, [FromBody] AmendmentReason amendmentReason) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != amendmentReason.ID) { return(BadRequest()); } _context.Entry(amendmentReason).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AmendmentReasonExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public void DeleteRegisteredSubjectEntity(RegisteredSubjectEntity registeredSubjectEntityToDelete) { using (var db = new PlutoContext()) { db.Entry(registeredSubjectEntityToDelete).State = EntityState.Deleted; db.SaveChanges(); } }
public void DeleteSubjectEntity(SubjectEntity subjectEntityToDelete) { using (var db = new PlutoContext()) { db.Entry(subjectEntityToDelete).State = EntityState.Deleted; db.SaveChanges(); } }
public void UpdateSubjectEntity(SubjectEntity subjectEntityToUpdate) { using (var db = new PlutoContext()) { db.Entry(subjectEntityToUpdate).State = EntityState.Modified; db.SaveChanges(); } }
public void DeleteTermEntity(TermEntity termEntityToDelete) { using (var db = new PlutoContext()) { db.Entry(termEntityToDelete).State = EntityState.Deleted; db.SaveChanges(); } }
public void UpdateTermEntity(TermEntity termEntityToUpdate) { using (var db = new PlutoContext()) { db.Entry(termEntityToUpdate).State = EntityState.Modified; db.SaveChanges(); } }
public void DeleteAttendanceEntity(AttendanceEntity attendanceEntityToDelete) { using (var db = new PlutoContext()) { db.Entry(attendanceEntityToDelete).State = EntityState.Deleted; db.SaveChanges(); } }
public void Update(T entity) { _context.Entry(entity).State = EntityState.Modified; //Save(); }