예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ISSN,Title,PublisherID,Weight,DimensionID,Pages,Age,Price,PublishingDate")] Comicbook comicbook)
        {
            if (id != comicbook.ISSN)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(comicbook);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ComicbookExists(comicbook.ISSN))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DimensionID"] = new SelectList(_context.Dimension, "ID", "Size", comicbook.DimensionID);
            ViewData["PublisherID"] = new SelectList(_context.Publisher, "ID", "Country", comicbook.PublisherID);
            return(View(comicbook));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("ISSN,Title,PublisherID,Weight,DimensionID,Pages,Age,Price,PublishingDate")] Comicbook comicbook)
        {
            if (ModelState.IsValid)
            {
                _context.Add(comicbook);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DimensionID"] = new SelectList(_context.Dimension, "ID", "Size", comicbook.DimensionID);
            ViewData["PublisherID"] = new SelectList(_context.Publisher, "ID", "Country", comicbook.PublisherID);
            return(View(comicbook));
        }
        public ActionResult Detail()
        {
            var comicBook = new Comicbook()
            {
                SeriesTitle     = "The Amazing Spider-Man",
                IssueNumber     = 700,
                DescriptionHtml = "<p>Final issue! Witness the final hours of Doctor Octopus' life and his one, last, great act of revenge! Even if Spider-Man survives... <strong>will Peter Parker?</strong></p>",
                Artists         = new Artist[]
                {
                    new Artist()
                    {
                        Name = "Script", Role = " Dan Slott"
                    },
                    new Artist()
                    {
                        Name = "Pencils", Role = "Humberto Ramos"
                    },
                    new Artist()
                    {
                        Name = "Inks", Role = " Victor Olazaba"
                    },
                    new Artist()
                    {
                        Name = "Colors", Role = "Edgar Delgado"
                    },
                    new Artist()
                    {
                        Name = "Letters", Role = "Chris Eliopoulos"
                    }
                }
            };



            return(View(comicBook));
        }