public virtual async Task <int> CreateAsync(TEntity model)
        {
            if (model == null)
            {
                throw new ArgumentNullException(string.Format(ErrorDetails.EntityCannotBeNull, nameof(TEntity)));
            }

            await dbContext.Set <TEntity>().AddAsync(model);

            await dbContext.SaveChangesAsync();

            return(model.Id);
        }
示例#2
0
 public virtual async Task <int> SaveChangesAsync()
 {
     return(await _con.SaveChangesAsync());
 }