Esempio n. 1
0
        public virtual async Task <long> AddAsync(Entity entity)
        {
            entity.CreatedDate = DateTime.UtcNow;
            entity.UpdatedDate = entity.CreatedDate;
            CreatePropertyIgnore(entity);
            await Db.AddAsync(entity);

            await Db.SaveChangesAsync();

            return(entity.Id);
        }
Esempio n. 2
0
        public virtual async Task <ItemItemStat> AddAsync(ItemItemStat ItemItemStat)
        {
            CreatePropertyIgnore(ItemItemStat);
            await Db.AddAsync(ItemItemStat);

            await Db.SaveChangesAsync();

            return(ItemItemStat);
        }
        public virtual async Task <ItemStatTradeOffer> AddAsync(ItemStatTradeOffer itemStatTradeOffer)
        {
            CreatePropertyIgnore(itemStatTradeOffer);
            await Db.AddAsync(itemStatTradeOffer);

            await Db.SaveChangesAsync();

            return(itemStatTradeOffer);
        }
Esempio n. 4
0
        public async Task <List <User> > BulkImportEmails(List <User> newUsers)
        {
            var foundUsers = await _userManager.Users.Where(x => newUsers.Select(u => u.Email.ToUpper()).Contains(x.NormalizedEmail)).Select(x => x.NormalizedEmail).ToListAsync();

            var usersToInsert = newUsers.Where(x => !foundUsers.Contains(x.Email.ToUpper())).ToList();

            foreach (var user in usersToInsert)
            {
                user.CreatedDate          = DateTime.UtcNow;
                user.UserName             = user.Email;
                user.NormalizedEmail      = _userManager.NormalizeEmail(user.Email);
                user.NormalizedUserName   = _userManager.NormalizeName(user.Email);
                user.EmailConfirmed       = false;
                user.AccessFailedCount    = 0;
                user.PhoneNumberConfirmed = false;
                await _db.AddAsync(user);
            }

            await _db.SaveChangesAsync();

            return(newUsers);
        }