Exemplo n.º 1
0
        public ActorController()
        {
            //initializes the connection, so it doesn't keep having to go to the AppSettings
            string connection = ConfigurationManager.ConnectionStrings["DataSource"].ConnectionString;

            _actorDAO = new ActorDAO(connection);
            _movieDAO = new MovieDAO(connection);
        }
Exemplo n.º 2
0
        public void FindAllActorTest()
        {
            List <Actor> listActor = null;

            listActor = ActorDAO.FindAll();

            Assert.IsNotNull(listActor);
        }
        /// <summary>
        /// The request to display search results.
        /// </summary>
        /// <param name="request">A request model that contains the search parameters.</param>
        /// <returns></returns>
        public ActionResult SearchResult(ActorSearch search)
        {
            /* Call the DAL and pass the values as a model back to the View */
            ActorDAO      dao    = new ActorDAO(connectionString);
            IList <Actor> result = dao.FindActors(search.FirstName);

            return(View(result));
        }
Exemplo n.º 4
0
        /// <summary>
        /// The request to display search results.
        /// </summary>
        /// <param name="request">A request model that contains the search parameters.</param>
        /// <returns></returns>
        public IActionResult SearchResult(Actor actor)
        {
            /* Call the DAL and pass the values as a model back to the View */
            ActorDAO      actorDAL  = new ActorDAO(@"Data Source=.\SQLEXPRESS;Initial Catalog=dvdstore;Integrated Security=True");
            IList <Actor> actorList = actorDAL.FindActors(actor.LastName);

            return(View(actorList));
        }
Exemplo n.º 5
0
        public void FindBuyIdActorTest()
        {
            Actor Actor = ActorDAO.FindBuyId(1);

            Assert.AreEqual(1, Actor.ActorId);

            Actor Actor2 = ActorDAO.FindBuyId(9999999);

            Assert.IsNull(Actor2);
        }
Exemplo n.º 6
0
        public void InsertActorTest()
        {
            Actor Actor = new Actor()
            {
                Name = "Name"
            };

            Assert.AreEqual(0, Actor.ActorId);

            ActorDAO.Insert(Actor);
            Assert.AreNotEqual(0, Actor.ActorId);
        }
Exemplo n.º 7
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            Actor actor = new Actor()
            {
                Name        = txtbName.Text,
                FirstName   = txtbFirstName.Text,
                Nationality = cmbNationality.SelectedValue.ToString(),
                DateOfBirth = txtbDateOfBirth.Text
            };

            ActorDAO.Insert(actor);

            DialogResult = DialogResult.OK;
            this.Close();
        }
Exemplo n.º 8
0
        public void DisplayDVG()
        {
            switch (cmbChoiceDisplay.SelectedValue)
            {
            case "Films":
                List <Film> listFilm = FilmDAO.FindAll();
                dgvData.DataSource = listFilm;
                break;

            case "Actors":
                List <Actor> listActor = ActorDAO.FindAll();
                dgvData.DataSource = listActor;
                break;
            }
        }