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(); }
//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(); }
//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(); }
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(); }