public ClassUser CreateUser(string firstName, string lastName, string userName, string emailAdress, string password, string adress, string phoneNumber, string Country, string Date_of_birth, string gender)
 {
     var item = _context.Users.FirstOrDefault(u => u.UserName == userName && u.EmailAdress == emailAdress);
     if (item == null)
     {
         ClassUser newuser = new ClassUser() {   
                                             
                                             FirstName = firstName,
                                             LastName = lastName,
                                             UserName = userName,
                                             EmailAdress = emailAdress,
                                             Password = password,
                                             Adress = adress,
                                             PhoneNumber = phoneNumber,
                                             country = Country,
                                             date_of_birth = Date_of_birth,
                                             Gender = gender};
         _context.Users.Add(newuser);
         _context.SaveChanges();
         return newuser;
     }
     else {
         return new ClassUser() {                                                      
                                 FirstName = "0",
                                 LastName = "0",
                                 UserName = "******",
                                 EmailAdress = "0",
                                 Password = "******",
                                 Adress = "0",
                                 PhoneNumber = "0",
                                 country = "0",
                                 date_of_birth = "0",
                                 Gender = "0"};
     }
 }
        public void AddSales(int maand, int jaar, float amount)
        {
            var item = _context.Monthlys.FirstOrDefault(d => d.month == maand && d.year == jaar);

            item.totalsales = item.totalsales + amount;
            _context.SaveChanges();
            Console.WriteLine(amount);
        }
Esempio n. 3
0
        public void CreateWishlist(string Item_Number, int user_id)
        {
            Wishlist newwishlist = new Wishlist()
            {
                Item_Number = Item_Number,
                user_id     = user_id,
            };

            _context.Wishlists.Add(newwishlist);
            _context.SaveChanges();
        }
Esempio n. 4
0
        public void CreateHistory(int order_id, string Item_Number, int user_id, int amount, string price, string date)
        {
            History newwishlist = new History()
            {
                order_id    = order_id,
                Item_Number = Item_Number,
                user_id     = user_id,
                amount      = amount,
                price       = price,
                Date        = date
            };

            _context.Historys.Add(newwishlist);
            _context.SaveChanges();
        }
        public void FindLegoDb([FromBody] string file)
        {
            string content = file;

            foreach (string line in content.Split("\n").Skip(0))
            {
                var  columns      = line.Split(",");
                var  Item_Number  = columns[0];
                var  Name         = columns[1];
                var  Year         = columns[2];
                var  Theme        = columns[3];
                var  Subtheme     = columns[4];
                var  Pieces       = columns[5];
                var  Minifigures  = columns[6];
                var  Image_URL    = columns[7];
                var  GBP_MSRP     = columns[8];
                var  USD_MSRP     = columns[9];
                var  CAD_MSRP     = columns[10];
                var  EUR_MSRP     = columns[11];
                var  Packaging    = columns[12];
                var  Availability = columns[13];
                Lego lego         = new Lego
                {
                    Item_Number  = Item_Number,
                    Name         = Name,
                    Year         = Year,
                    Theme        = Theme,
                    Subtheme     = Subtheme,
                    Pieces       = Pieces,
                    Minifigures  = Minifigures,
                    Image_URL    = Image_URL,
                    GBP_MSRP     = GBP_MSRP,
                    USD_MSRP     = USD_MSRP,
                    CAD_MSRP     = CAD_MSRP,
                    EUR_MSRP     = EUR_MSRP,
                    Packaging    = Packaging,
                    Availability = Availability
                };


                _context.Add(lego);
                _context.SaveChanges();
            }
        }
Esempio n. 6
0
        public void Amount(string item_number, int user_id)
        {
            // Shoppingcart newamount = new Shoppingcart()
            // {
            //     Item_Number = item_number
            //                                 ,
            //     amount = amount,
            //     user_id = user_id
            // };
            // _context.Shoppingcarts.Update(newamount);
            // _context.Entry(newamount);
            // _context.SaveChanges();

            var am = _context.Shoppingcarts.FirstOrDefault(d => d.Item_Number == item_number && d.user_id == user_id);

            am.amount = am.amount + 1;

            _context.SaveChanges();
        }
Esempio n. 7
0
        public void addCart(string _id, string _productName)
        {
            var item = _context.Datas.FirstOrDefault(d => d.productID == _id);

            if (item == null)
            {
                item = new ProductData()
                {
                    productID = _id, productName = _productName, purchases = 0, shoppingcart = 1, wishlist = 0
                };
                _context.Datas.Add(item);
                _context.SaveChanges();
            }
            else
            {
                item.shoppingcart = item.shoppingcart + 1;
                _context.SaveChanges();
            }
        }