예제 #1
0
        public async Task <IActionResult> Create([Bind("ArtistId,Name")] Artist artist)
        {
            if (ModelState.IsValid)
            {
                _context.Add(artist);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(artist));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("RecordId,Name,Year,ArtistId")] Record @record)
        {
            if (ModelState.IsValid)
            {
                _context.Add(@record);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ArtistId"] = new SelectList(_context.Artists, "ArtistId", "ArtistId", @record.ArtistId);
            return(View(@record));
        }
예제 #3
0
        public async Task <IActionResult> Create([Bind("LendingId,Name,Date,RecordId")] Lending lending)
        {
            if (ModelState.IsValid)
            {
                _context.Add(lending);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["RecordId"] = new SelectList(_context.Records, "RecordId", "Name", lending.RecordId);
            return(View(lending));
        }
예제 #4
0
        public async Task <IActionResult> Create([Bind("CdID,Name,ReleaseYear,ArtistID")] Cd cd)
        {
            if (ModelState.IsValid)
            {
                _context.Add(cd);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ArtistID"] = new SelectList(_context.Artist, "ArtistID", "Name", cd.ArtistID);
            return(View(cd));
        }