示例#1
0
 public void CustDelte(int CustID)
 {
     using (VideoEntities3 context = new VideoEntities3())
     {
         Customer obj = context.Customers.First(x => x.CustID == CustID); //this delete the cust id if it matches the varable
         context.Customers.Remove(obj);
         context.SaveChanges();                                           //this saves the changes
     }
 }
示例#2
0
 public void VideoDelte(int movieID)
 {
     using (VideoEntities3 context = new VideoEntities3())
     {
         Movy obj = context.Movies.First(x => x.MovieID == movieID); //this delte the row where movie id matches with variable
         context.Movies.Remove(obj);
         context.SaveChanges();                                      //this saves the changes
     }
 }
示例#3
0
        public void CustUpdate(int CustID, string Firstname, string lastname, string phone, string address)
        {
            using (var db = new VideoEntities3())
            {
                var result = db.Customers.SingleOrDefault(b => b.CustID == CustID);//this updates the whole row where cust id is same as varable
                if (result != null)
                {
                    result.FirstName = Firstname;
                    result.LastName  = lastname;
                    result.Phone     = phone;
                    result.Address   = address;


                    db.SaveChanges();//this saves the changes
                }
            }
        }
示例#4
0
        public void VideoUpdate(int movieID, string Title, string Rateing, string copies, string Genre, string Plot, string Year)
        {
            using (var db = new VideoEntities3())
            {
                var result = db.Movies.SingleOrDefault(b => b.MovieID == movieID);//this updates the roe where movie id matches with variable
                if (result != null)
                {
                    result.Title  = Title;
                    result.Rating = Rateing;
                    result.Genre  = Genre;
                    result.Plot   = Plot;
                    result.Copies = copies;
                    result.Year   = Year;

                    db.SaveChanges();//this saves the changes
                }
            }
        }
        protected void Login_Click(object sender, EventArgs e)
        {
            String id = Login_txt.Text;

            VideoEntities3 db    = new VideoEntities3();
            string         query = (from c in db.Logins//this checks the login info from the database
                                    where c.UserName == id && c.Password == Password_txt.Text
                                    select c.UserName).FirstOrDefault();

            if (query != null)
            {
                Response.Redirect("Video.aspx");//if login info is right this opens the video page
            }
            else
            {
                Response.Write("Invalid User");//if login info is worng it shows the error
            }
        }