public IActionResult Delete(int? id)
        {
            if (id == null)
            {
                return HttpNotFound();
            }

            LibraryAndSection libraryAndSection = new LibraryAndSection();
            libraryAndSection.Section = _context.Section.Single(m => m.SectionID == id);
            if (libraryAndSection.Section == null)
            {
                return HttpNotFound();
            }

            int intLibraryID = libraryAndSection.Section.LibraryID;
            libraryAndSection.Library = _context.Library.Single(m => m.LibraryID == intLibraryID);

            return View(libraryAndSection);
        }
        // GET: Sections/Edit/5
        public IActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(HttpNotFound());
            }

            LibraryAndSection libraryAndSection = new LibraryAndSection();

            libraryAndSection.Section = _context.Section.Single(m => m.SectionID == id);
            if (libraryAndSection.Section == null)
            {
                return(HttpNotFound());
            }

            libraryAndSection.Library = _context.Library.Single(m => m.LibraryID == libraryAndSection.Section.LibraryID);

            ViewBag.Libraries = new SelectList(_context.Library, "LibraryID", "Name", libraryAndSection.Section.LibraryID);

            return(View(libraryAndSection));
        }
        public IActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(HttpNotFound());
            }

            LibraryAndSection libraryAndSection = new LibraryAndSection();

            libraryAndSection.Section = _context.Section.Single(m => m.SectionID == id);
            if (libraryAndSection.Section == null)
            {
                return(HttpNotFound());
            }

            int intLibraryID = libraryAndSection.Section.LibraryID;

            libraryAndSection.Library = _context.Library.Single(m => m.LibraryID == intLibraryID);

            return(View(libraryAndSection));
        }
Example #4
0
        // GET: Libraries/Details/5
        public IActionResult Details(int?id)
        {
            if (id == null)
            {
                return(HttpNotFound());
            }

            ViewData["Message"] = HttpContext.Session.GetString("Message");
            HttpContext.Session.Remove("Message");

            LibraryAndSection libraryAndSection = new LibraryAndSection();

            libraryAndSection.Library = _context.Library.Single(m => m.LibraryID == id);
            if (libraryAndSection.Library == null)
            {
                return(HttpNotFound());
            }

            libraryAndSection.Section  = new Section();
            libraryAndSection.Sections = _context.Section.Where(l => l.LibraryID == id);

            return(View(libraryAndSection));
        }
        // GET: Libraries/Details/5
        public IActionResult Details(int? id)
        {
            if (id == null)
            {
                return HttpNotFound();
            }

            ViewData["Message"] = HttpContext.Session.GetString("Message");
            HttpContext.Session.Remove("Message");

            LibraryAndSection libraryAndSection = new LibraryAndSection();
            libraryAndSection.Library = _context.Library.Single(m => m.LibraryID == id);
            if (libraryAndSection.Library == null)
            {
                return HttpNotFound();
            }

            libraryAndSection.Section = new Section();
            libraryAndSection.Sections = _context.Section.Where(l => l.LibraryID == id);

            return View(libraryAndSection);
        }
        // GET: Sections/Edit/5
        public IActionResult Edit(int? id)
        {
            if (id == null)
            {
                return HttpNotFound();
            }

            LibraryAndSection libraryAndSection = new LibraryAndSection();
            libraryAndSection.Section = _context.Section.Single(m => m.SectionID == id);
            if (libraryAndSection.Section == null)
            {
                return HttpNotFound();
            }

            libraryAndSection.Library = _context.Library.Single(m => m.LibraryID == libraryAndSection.Section.LibraryID);

            ViewBag.Libraries = new SelectList(_context.Library, "LibraryID", "Name", libraryAndSection.Section.LibraryID);

            return View(libraryAndSection);
        }