Ejemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("CDID ,Album,Genre,ReleaseDate,ArtistNameID, Lended")] CD cD)
        {
            if (ModelState.IsValid)
            {
                _context.Add(cD);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(cD));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("ArtistID,ArtistName")] Artist artist)
        {
            if (ModelState.IsValid)
            {
                _context.Add(artist);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(artist));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("PersonID,CDSID,Name,SurName,Lended")] CDLended cDLended)
        {
            if (ModelState.IsValid)
            {
                var linq = _context.CD.SingleOrDefault(x => x.CDID == cDLended.CDSID);
                cDLended.CDs = linq;
                _context.Add(cDLended);
                linq.Lended = true;
                _context.Update(linq);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(cDLended));
        }