public async Task <IActionResult> Edit(int id, [Bind("Id,Firstnameauhor1,Lastnameauhor1,Firstnameauhor2,Lastnameauhor2,Firstnameauhor3,Lastnameauhor3,Furtherauthors,Title,Newspapername,Issue,Publicationdate,Pages")] Newspapers newspapers) { if (id != newspapers.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(newspapers); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!NewspapersExists(newspapers.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(newspapers)); }
//silme public void Delete(Newspapers newspapers) { using (InstituteDbEntities context = new InstituteDbEntities()) { var entity = context.Entry(newspapers); entity.State = EntityState.Deleted; context.SaveChanges(); } }
public async Task <IActionResult> Create([Bind("Id,Firstnameauhor1,Lastnameauhor1,Firstnameauhor2,Lastnameauhor2,Firstnameauhor3,Lastnameauhor3,Furtherauthors,Title,Newspapername,Issue,Publicationdate,Pages")] Newspapers newspapers) { if (ModelState.IsValid) { _context.Add(newspapers); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(newspapers)); }
public async Task <IActionResult> CreateAndConnect(string tablename, int tableid, int infotype, string currentpath, [Bind("Id,Firstnameauhor1,Lastnameauhor1,Firstnameauhor2,Lastnameauhor2,Firstnameauhor3,Lastnameauhor3,Furtherauthors,Title,Newspapername,Issue,Publicationdate,Pages")] Newspapers newspapers) { int id = new int(); String[] url = new String[4]; if (ModelState.IsValid) { _context.Add(newspapers); await _context.SaveChangesAsync(); List <Newspapers> allentries = new List <Newspapers>(); allentries = await _context.Newspapers.ToListAsync(); foreach (Newspapers item in allentries) { if (item == newspapers) { id = newspapers.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(newspapers)); }
private void Awake() { instance = this; }