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);
            }
        }
Example #2
0
 public int Add(T entity)
 {
     using (var dbContext = new WebContextDB())
     {
         dbContext.Entry(entity).State = EntityState.Added;
         return(dbContext.SaveChanges());
     }
 }