public int Add(T entity) { using (var dbContext = new WebContextDB()) { dbContext.Entry(entity).State = EntityState.Added; return(dbContext.SaveChanges()); } }
public int AddBusinessentity(BusinessEntity entity) { int id; using (var dbContext = new WebContextDB()) { dbContext.Entry(entity).State = EntityState.Added; dbContext.SaveChanges(); dbContext.Entry(entity).GetDatabaseValues(); return(id = entity.BusinessEntityID); } }