public async Task <IActionResult> Edit(int id, [Bind("Id,Firstnameauhor1,Lastnameauhor1,Firstnameauhor2,Lastnameauhor2,Firstnameauhor3,Lastnameauhor3,Furtherauthors,Title,Type,Schoollocation,Edition,Publicationdate,Pages")] Unpublished unpublished) { if (id != unpublished.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(unpublished); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UnpublishedExists(unpublished.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(unpublished)); }
public async Task <IActionResult> Create([Bind("Id,Firstnameauhor1,Lastnameauhor1,Firstnameauhor2,Lastnameauhor2,Firstnameauhor3,Lastnameauhor3,Furtherauthors,Title,Type,Schoollocation,Edition,Publicationdate,Pages")] Unpublished unpublished) { if (ModelState.IsValid) { _context.Add(unpublished); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(unpublished)); }
public async Task <IActionResult> CreateAndConnect(string tablename, int tableid, int infotype, string currentpath, [Bind("Id,Firstnameauhor1,Lastnameauhor1,Firstnameauhor2,Lastnameauhor2,Firstnameauhor3,Lastnameauhor3,Furtherauthors,Title,Type,Schoollocation,Edition,Publicationdate,Pages")] Unpublished unpublished) { int id = new int(); String[] url = new String[4]; if (ModelState.IsValid) { _context.Add(unpublished); await _context.SaveChangesAsync(); List <Unpublished> allentries = new List <Unpublished>(); allentries = await _context.Unpublished.ToListAsync(); foreach (Unpublished item in allentries) { if (item == unpublished) { id = unpublished.Id; } } var relation = new InfoSourcesInRelation { Tablename = tablename, Tableid = tableid, Infotype = infotype, Infosourceid = id }; _context.Add(relation); await _context.SaveChangesAsync(); url = currentpath.Split('/'); return(RedirectToAction(url[3], url[2], new { id = url[4] })); //return RedirectToAction("CreateAndConnect", "InfoSourcesInRelations", new { tablename = tablename, tableid = tableid, infotype = infotype, infosourceid = id, currentpath = currentpath }); } return(View(unpublished)); }