Exemple #1
0
        // GET: Artists/Create
        public ActionResult Create()
        {
            var addForm = new ArtistAddForm();

            addForm.Genre            = new SelectList(m.AllGenres());
            addForm.BirthOrStartDate = DateTime.Now.AddYears(-30);
            addForm.StartDecade      = ((int)((DateTime.Now.Year - 10) / 10)) * 10;

            return(View(addForm));
        }
Exemple #2
0
        // GET: Artists/Create
        public ActionResult Create()
        {
            //AddForm Model
            var form = new ArtistAddForm();

            //Set default value & SelectList
            form.BirthOrStartDate = DateTime.Now.AddYears(-30);

            form.StartDecade = ((int)((DateTime.Now.Year - 10) / 10)) * 10;
            form.Genre       = new SelectList(m.AllGenres());
            return(View(form));
        }
        // GET: Artists/Create
        public ActionResult Create()
        {
            // Create and configure an 'add form'
            var addForm = new ArtistAddForm();

            // Fetch the genres
            addForm.Genre = new SelectList(m.AllGenres());

            // Set a reasonable start date in the user interface
            addForm.BirthOrStartDate = DateTime.Now.AddYears(-30);

            // Set a reasonable start decade in the user interface
            // The formula rounds off a date to the nearest 10
            addForm.StartDecade = ((int)((DateTime.Now.Year - 10) / 10)) * 10;

            return View(addForm);
        }