Beispiel #1
0
        public async Task EnsureSeedDataAsync()
        {
            if (await _userManager.FindByEmailAsync("*****@*****.**") == null)
            {
                var newUser = new User()
                {
                    UserName = "******",
                    Email    = "*****@*****.**"
                };

                await _userManager.CreateAsync(newUser, "Pa&&w0rd");
            }

            if (_context.Transactions.Any())
            {
                return;
            }

            var outTrans1 = new Transaction()
            {
                Title           = "Food",
                CreationDate    = DateTime.Now,
                User            = await _userManager.FindByEmailAsync("*****@*****.**"),
                Amount          = -230,
                Description     = "-",
                TransactionType = TransactionType.UserOut
            };

            _context.Transactions.Add(outTrans1);

            _context.SaveChanges();
        }
Beispiel #2
0
 public bool SaveAll()
 {
     return(_ctx.SaveChanges() > 0);
 }