Exemple #1
0
        public ActionResult AddTrack(int?id)
        {
            // Attempt to get the associated object
            var a = m.ArtistGetByIdWithDetail(id.GetValueOrDefault());

            if (a == null)
            {
                return(HttpNotFound());
            }
            else
            {
                // Prepare the form
                var form = new TrackAddForm();

                // Attention 16 - Prepare the data for the add track form

                // Album name and identifier
                form.AlbumName = a.Name;
                form.AlbumId   = a.Id;

                // Genre list
                form.GenreList = new SelectList(m.GenreGetAll(), dataValueField: "Name", dataTextField: "Name");

                // Attention 17 - Study the view code too

                return(View(form));
            }
        }
        public ActionResult Create()
        {
            var form = new TrackAddForm();

            form.GenreList = new SelectList
                                 (items: m.GenreGetAll(),
                                 dataValueField: "Name",
                                 dataTextField: "Name");

            return(View(form));
        }
Exemple #3
0
        // GET: Vehicles/Create
        public ActionResult Create()
        {
            var form = new TrackAddForm();

            return(View(form));
        }