Ejemplo n.º 1
0
        // GET: CDs/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Session["CdID"] = id;
            CDs cDs = base.DB.CDs.Find(id);

            if (cDs == null)
            {
                return(HttpNotFound());
            }
            DetailViewModel viewModel = new DetailViewModel
            {
                AddToCartViewModel = new AddToCartViewModel()
                {
                    CD       = cDs,
                    Quantity = 1
                },
                CommentViewModel = new CommentViewModel()
                {
                    CdID = id.Value
                },
                CommentListViewModel = new List <CommentViewModel>()
            };

            return(View(viewModel));
        }
Ejemplo n.º 2
0
        public ActionResult Create()
        {
            CDs newCDs = new CDs(Request.Form["new-CDs"]);

            newCDs.Save();
            List <CDs> allCDs = CDs.GetAll();

            return(View("Index", allCDs));
        }
Ejemplo n.º 3
0
        public ActionResult CdList()
        {
            string newCdTitle = Request.Form["new-title"];
            CDs    newCD      = new CDs(newCdTitle);

            List <CDs> newList = CDs.GetAllCds();

            return(View(newList));
        }
Ejemplo n.º 4
0
        public void DisplayMediaOptions()
        {
            List <Media> toDisplay;

            Console.WriteLine("\n\t\tWhich format would you like to browse?");
            Console.WriteLine("\n\t\t\t[1] Books");
            Console.WriteLine("\n\t\t\t[2] Magazines");
            Console.WriteLine("\n\t\t\t[3] Music");
            Console.WriteLine("\n\t\t\t[4] Browse All");
            Console.WriteLine("\n\t\t\t[5] Return to main menu");

            ConsoleKeyInfo keyInput = Console.ReadKey();

            if (keyInput.Key == ConsoleKey.D1 || keyInput.Key == ConsoleKey.NumPad1)
            {
                toDisplay = Books.Cast <Media>().ToList();

                Console.Clear();
                Console.WriteLine("\t\t==========BOOKS==========");
                DisplayBooks();
                ReserveMedia(toDisplay);
            }
            else if (keyInput.Key == ConsoleKey.D2 || keyInput.Key == ConsoleKey.NumPad2)
            {
                toDisplay = Magazines.Cast <Media>().ToList();

                Console.Clear();
                Console.WriteLine("\t\t========MAGAZINES========");
                DisplayMagazines();
                ReserveMedia(toDisplay);
            }
            else if (keyInput.Key == ConsoleKey.D3 || keyInput.Key == ConsoleKey.NumPad3)
            {
                toDisplay = CDs.Cast <Media>().ToList();

                Console.Clear();
                Console.WriteLine("\t\t==========MUSIC==========");
                DisplayMusic();
                ReserveMedia(toDisplay);
            }
            else if (keyInput.Key == ConsoleKey.D4 || keyInput.Key == ConsoleKey.NumPad4)
            {
                Console.Clear();
                Console.WriteLine("\t\t===========ALL===========");
                DisplayAllMedia();
                ReserveMedia(Medias);
            }
            else if (keyInput.Key == ConsoleKey.D5 || keyInput.Key == ConsoleKey.NumPad5)
            {
                Console.Clear();
                return;
            }
        }
Ejemplo n.º 5
0
 public void DisplayMusic()
 {
     if (CDs.Count != 0)
     {
         foreach (MusicCD music in CDs)
         {
             Console.WriteLine($"\n\t\t[{CDs.IndexOf(music) + 1}]-----Album: \"{music.Album}\" \n\t\t\tArtist: {music.Artist} \n\t\t\tStatus: {music.Status}");
         }
     }
     else
     {
         Console.WriteLine("\n\n\t\tPlease enter a valid option\n\n\t\tPress [ENTER] to return to main menu");
     }
 }
Ejemplo n.º 6
0
        public ActionResult Index()
        {
            List <CDs> allCDs = CDs.GetAll();

            return(View(allCDs));
        }
Ejemplo n.º 7
0
        static void Main(string[] args)//only do 1-4 8 objects total
        {
            //1) student
            Student transfer = new Student("Maria", "Sanchez", "3579", 3.9f);
            Student current  = new Student();

            current.FirstName = "Larry";
            current.LastName  = "Walters";
            current.Id        = "0123";
            current.Gpa       = 2.9f;

            Console.WriteLine($"{transfer}\n\n{current}\n\n");

            //2) vehicle
            Vehicle old      = new Vehicle("Chevy", "Celebrity", 1984, 2.5f);
            Vehicle newModel = new Vehicle();

            newModel.Make   = "Toyota";
            newModel.Model  = "Prius";
            newModel.Year   = 2005;
            newModel.Weight = 3;

            Console.WriteLine($"{old} compared to the new {newModel}\n\n");

            //3) Username
            Login currentPass = new Login("asdghkl", "1234asdf");
            Login previous    = new Login();

            previous.UserName = "******";
            previous.Password = "******";

            Console.WriteLine($"{currentPass}\n\n");
            Console.WriteLine($"{previous}\n\n");

            //4) Contact Info

            ContactInfo info1 = new ContactInfo("413 Ranchero Pl", "Belton", "Missouri", "64012",
                                                "555-555-5555", "*****@*****.**");
            ContactInfo bigBird = new ContactInfo();

            bigBird.StreetAddress = "123 Sesame Street";
            bigBird.City          = "New York City";
            bigBird.State         = "New York";
            bigBird.Zip           = "12345";
            bigBird.Phone         = "(123) 456-7890";
            bigBird.Email         = "*****@*****.**";
            Console.WriteLine($"{info1}\n\n{bigBird}");


            //Wednesday Homework 5-8

            Console.Clear();
            //List<ContactInfo> customerContact = new List<ContactInfo> { info1, bigBird };//list for customer info
            //5)Customer info

            Customer c1 = new Customer("13357", "Alysha", "Williams", info1);
            Customer c2 = new Customer();

            c2.CustomerId      = "1234";
            c2.FirstName       = "Big";
            c2.LastName        = "Bird";
            c2.CustomerContact = bigBird;
            Console.WriteLine($"{c1}\n");
            Console.WriteLine($"{c2}\n");


            //6)Credit Card Account //giving me index errors how to fix them


            CreditCardAccount cc1 = new CreditCardAccount(768450, c1, 789596.98m, false, 15.3m);
            CreditCardAccount cc2 = new CreditCardAccount();

            cc2.AccountNumber     = 02345;
            cc2.CustomerInfo      = c2;
            cc2.Balance           = 1345.2m;
            cc2.IsPastDue         = true;
            cc2.AnnualInterstRate = 1.3m;
            Console.WriteLine($"{cc1}\n");
            Console.WriteLine($"{cc2}\n");

            //7)Book

            Book newb1 = new Book("How to Write Adventure Modules that Don't Suck", "Goodman Games", 156);
            Book newb2 = new Book();

            newb2.Title         = "The Den of Shadows";
            newb2.Author        = "Amelia Atwater-Rhoades";
            newb2.NumberOfPages = 595;
            Console.WriteLine($"{newb1}\n");
            Console.WriteLine($"{newb2}\n");

            //8) Library
            List <Book> books = new List <Book> {
                newb1, newb2
            };

            Library library1 = new Library(books, "Peculiar Library", "123 Street", "Peculiar", "Missouri", "64080");
            Library library2 = new Library();

            library2.Books         = books;
            library2.LibraryName   = "Grandview Library";
            library2.StreetAddress = "123 Main";
            library2.City          = "Grandview";
            library2.State         = "Missouri";
            library2.Zip           = "64012";
            Console.WriteLine($"{library1}\n");
            Console.WriteLine($"{library2}\n");

            //9)Songs parent of CD

            Songs ns1 = new Songs("Panic! At the Disco", "Saturday Night", 120);
            Songs ns2 = new Songs();

            ns2.Artist          = "Panic! At the Disco";
            ns2.Title           = "Amen";
            ns2.LengthInSeconds = 200;

            Console.WriteLine(ns1);
            Console.WriteLine(ns2);
            Console.Clear();
            //10) CD
            string[] Songs = new string[2];
            Songs[0] = Convert.ToString(ns1);
            Songs[1] = Convert.ToString(ns2);
            Console.WriteLine(Songs[1]);
            Console.WriteLine(Songs[0]);

            CDs ncd1 = new CDs("Panic! At the Disco", "Alternative", Songs);//last spot is printing System.String[]

            Console.WriteLine(ncd1);
            CDs ncd2 = new CDs();

            ncd2.Artist = "Little Mix";
            //ncd2.Title = "Hair";
            //ncd2.LengthInSeconds = 380;
            ncd2.Genre = "Pop";
            ncd2.Songs = Songs;
            Console.WriteLine(ncd2);

            //11)
            //11. MotorHome – extend Vehicle
            //a.numberOfBeds – int
            MotorHome mh1 = new MotorHome("Ford", "OffRoad", 1999, 3.4f, 1.5f);
            MotorHome mh2 = new MotorHome();

            mh2.Make         = "Chevy";
            mh2.Model        = "Forester";
            mh2.Year         = 2003;
            mh2.Weight       = 4;
            mh2.NumberOfBeds = 2.5f;
            Console.WriteLine(mh1);
            Console.WriteLine(mh2);

            //12)Truck ==loadCapacity
            Trucks nt1 = new Trucks("Jeep", "Jeep", 2015, 2.4f, 2.2f);
            Trucks nt2 = new Trucks();

            nt2.Make         = "Toyota";
            nt2.Model        = "Sienna";
            nt2.Year         = 2019;
            nt2.Weight       = 3;
            nt2.LoadCapacity = 4;
            Console.WriteLine(nt1);
            Console.WriteLine(nt2);
        } //end main()
Ejemplo n.º 8
0
 public List <CD> GetCDsByTrackCount(int CDTrackCount)
 {
     return(CDs.FindAll(c => c.TrackCount == CDTrackCount));
 }
Ejemplo n.º 9
0
 public List <CD> GetCDsByArtist(string CDArtistName)
 {
     return(CDs.FindAll(c => c.ArtistName == CDArtistName));
 }
Ejemplo n.º 10
0
 public List <CD> GetCDs(int CDBorrowCount)
 {
     return(CDs.FindAll(c => c.BorrowCount == CDBorrowCount));
 }
Ejemplo n.º 11
0
 public List <CD> GetCDs(bool CDState)
 {
     return(CDs.FindAll(c => c.State == CDState));
 }
Ejemplo n.º 12
0
 public List <CD> GetCDs(string CDTitle)
 {
     return(CDs.FindAll(c => c.Title.ToLower().Contains(CDTitle.ToLower())));
 }