Esempio n. 1
0
 /// <summary>
 /// Inserts the specified entity.
 /// </summary>
 /// <param name="entities">The entities.</param>
 public virtual void Insert(params TEntity[] entities)
 {
     foreach (var entity in entities)
     {
         Dbset.Add(entity);
     }
 }
Esempio n. 2
0
 public void InsertBulk(IEnumerable <Track> Entities)
 {
     foreach (Track track in Entities)
     {
         if (db.Entry(track).State == EntityState.Detached)
         {
             Dbset.Add(track);
         }
     }
     db.SaveChanges();
     Dbset.AddRange(Entities);
 }
Esempio n. 3
0
        public override void Create(Task task)
        {
            if (Dbset.Any(x => x.Id != task.Id &&
                          x.UserId == task.UserId &&
                          x.Title.Equals(task.Title, StringComparison.OrdinalIgnoreCase) &&
                          x.ShortTitle.Equals(task.ShortTitle, StringComparison.OrdinalIgnoreCase) &&
                          x.Theme == task.Theme))
            {
                throw new MyException("You already have a Task with the same Title, Short Title and Theme.");
            }

            task.Order = Convert.ToInt16(Dbset.Count(x => x.UserId == task.UserId && x.IsArchived == false) + 1);
            Dbset.Add(task);
            _context.SaveChanges();
        }
Esempio n. 4
0
 public virtual void Add(T entity)
 {
     Dbset.Add(entity);
 }
 public void Insert(Product product)
 {
     Dbset.Add(product);
 }
Esempio n. 6
0
 public void Inserir(TEntity t)
 {
     Dbset.Add(t);
     Context.SaveChanges();
 }
Esempio n. 7
0
 /// <summary>
 /// 插入单条数据
 /// </summary>
 /// <param name="entity">TEntity实体</param>
 public virtual void Insert(TEntity entity)
 {
     Dbset.Add(entity);
 }
Esempio n. 8
0
 /// <summary>
 /// 添加数据
 /// </summary>
 /// <param name="tentity"></param>
 public void Add(Tentity tentity)
 {
     Dbset.Add(tentity);
 }