Exemple #1
0
        public void AddProduct(string title, int quantity, decimal price)
        {
            var product = new Product()
            {
                Title    = title,
                Quantity = quantity,
                Price    = price
            };

            _context.Products.Add(product);
            _context.SaveChanges();
        }
Exemple #2
0
        public void CheckDefaultAdmin()
        {
            var admin = _context.Users.Where(x => x.Email == "*****@*****.**").Where(x => x.IsAdmin == true).ToList();

            if (admin.Count() == 0)
            {
                var adminUser = new User()
                {
                    Email    = "*****@*****.**",
                    Password = "******",
                    IsAdmin  = true
                };
                _context.Users.Add(adminUser);
                _context.SaveChanges();
            }
        }