Пример #1
0
 public void updateBalance(int customerID, int rentalID)
 {
     DVDRentalEntities db = new DVDRentalEntities();
      var customer = db.Users.FirstOrDefault(x => x.ID == customerID);
      customer.Balance += Convert.ToDecimal(new RentalItemBLL().GetRentalItemById(rentalID).Price);
      db.SaveChanges();
 }
Пример #2
0
 //Add notifications that use the getUserFines method in the user class.
 public void AddNotification(int cid)
 {
     var db = new DVDRentalEntities();
     var n = new Notification
     {
         Date = DateTime.Now,
         CustomerID = cid,
     };
     db.Notifications.Add(n);
     db.SaveChanges();
 }
Пример #3
0
 //Add a sale into the database.
 public void AddSales(int rid,int cid,int eid)
 {
     var db = new DVDRentalEntities();
      var s = new Sale
      {
          Date= DateTime.Now,
          RentalItemID=rid,
          CustomerID=cid,
          EmployeeID=eid,
      };
      db.Sales.Add(s);
      db.SaveChanges();
 }
Пример #4
0
        public void AddUser(string name, string surname, string idnumber, string address, string contactNumber, string email, string role, string username, string password)
        {
            DVDRentalEntities db = new DVDRentalEntities();
            string hashPass = new HashBLL().CreateHash(password);
            User u = new User
            {
                Name = name,
                Surname = surname,
                IDNumber = idnumber,
                Address = address,
                ContactNumber = contactNumber,
                Email = email,
                Role = role,
                Username = username,
                Password = hashPass
            };

            db.Users.Add(u);
            db.SaveChanges();
        }