public async Task <IActionResult> Create([Bind("Id,Books,Series,Journals,Collections,Unpublished,Newspapers,Officialstatements,Websites")] InfoSources infoSources) { if (ModelState.IsValid) { _context.Add(infoSources); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewData["Books"] = new SelectList(_context.Books, "Id", "Firstnameauhor1", infoSources.Books); ViewData["Collections"] = new SelectList(_context.Collections, "Id", "Firstnameauhor1", infoSources.Collections); ViewData["Journals"] = new SelectList(_context.Journals, "Id", "Firstnameauhor1", infoSources.Journals); ViewData["Newspapers"] = new SelectList(_context.Newspapers, "Id", "Firstnameauhor1", infoSources.Newspapers); ViewData["Officialstatements"] = new SelectList(_context.OfficialStatements, "Id", "Publisher", infoSources.Officialstatements); ViewData["Series"] = new SelectList(_context.Series, "Id", "Firstnameauhor1", infoSources.Series); ViewData["Unpublished"] = new SelectList(_context.Unpublished, "Id", "Firstnameauhor1", infoSources.Unpublished); ViewData["Websites"] = new SelectList(_context.Websites, "Id", "Title", infoSources.Websites); return(View(infoSources)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Books,Series,Journals,Collections,Unpublished,Newspapers,Officialstatements,Websites")] InfoSources infoSources) { if (id != infoSources.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(infoSources); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!InfoSourcesExists(infoSources.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["Books"] = new SelectList(_context.Books, "Id", "Firstnameauhor1", infoSources.Books); ViewData["Collections"] = new SelectList(_context.Collections, "Id", "Firstnameauhor1", infoSources.Collections); ViewData["Journals"] = new SelectList(_context.Journals, "Id", "Firstnameauhor1", infoSources.Journals); ViewData["Newspapers"] = new SelectList(_context.Newspapers, "Id", "Firstnameauhor1", infoSources.Newspapers); ViewData["Officialstatements"] = new SelectList(_context.OfficialStatements, "Id", "Publisher", infoSources.Officialstatements); ViewData["Series"] = new SelectList(_context.Series, "Id", "Firstnameauhor1", infoSources.Series); ViewData["Unpublished"] = new SelectList(_context.Unpublished, "Id", "Firstnameauhor1", infoSources.Unpublished); ViewData["Websites"] = new SelectList(_context.Websites, "Id", "Title", infoSources.Websites); return(View(infoSources)); }