/// <summary> /// Generic update method for the entities /// </summary> /// <param name="entityToUpdate"></param> public void Update(TEntity entityToUpdate) { try { _context.Set <TEntity>().AddOrUpdate(entityToUpdate); //DbSet.Attach(entityToUpdate); //_dbContext.Entry(entityToUpdate).State = EntityState.Modified; } catch (Exception e) { throw new Exception(e.Message); } }
public Repository(SurvayArmDbContext context) { _context = context ?? new SurvayArmDbContext(); DbSet = _context.Set <TEntity>(); }