Example #1
0
        private async void SeedData()
        {
            if (context.QuestionSet.Count <Question>() == 0)
            {
                await context.AddAsync <Question>(new Question { Id = 1, Text = "How many planets are there in Solar System?", CorrectAnswer = "8" });

                await context.SaveChangesAsync();
            }
        }
Example #2
0
        public async Task <User> Register(User user, string password)
        {
            byte[] passwordHash, passwordSalt;
            CreatePasswordHash(password, out passwordHash, out passwordSalt);
            user.PasswordHash = passwordHash;
            user.PasswordSalt = passwordSalt;
            user.UserName     = user.UserName.ToLower();
            await db.AddAsync(user);

            await db.SaveChangesAsync();

            return(user);
        }
 public async Task AddCategoryAsync(CategoryEntity entity) => await context.AddAsync(entity);